// ESP-01_LedFlasher.ino // install SafeString library from the library manager for PinFlasher #include // see the tutorial https://www.forward.com.au/pfod/ArduinoProgramming/TimingDelaysInArduino.html /* (c)2021 Forward Computing and Control Pty. Ltd. NSW Australia, www.forward.com.au This code is not warranted to be fit for any purpose. You may only use it at your own risk. This generated code may be freely used for both private and commercial use provided this copyright is maintained. */ // un comment this to start Serial for debug ouput // else comment out to allow GPIO1 (TX) to flash blue led on ESP-01 //#define DEBUG int flasher_pin = 1; // GPIO1 for led on ESP-01 PinFlasher flasher(flasher_pin, true); // true for invert output logic, // default logic is HIGH for on, inverted logic is LOW for on // ESP pins are active LOW so should invert so flasher.setOnOff(PIN_ON) turns led on. void setup() { #ifdef DEBUG Serial.begin(115200); for (int i = 10; i > 0; i--) { Serial.print(i); Serial.print(' '); delay(500); } Serial.println(); #endif flasher.setOnOff(1000); // on for 1sec then off for 1sec } unsigned long counter = 0; void loop() { flasher.update(); // should call this often, atleast every loop() #ifdef DEBUG Serial.println(counter++); #endif }