// ESP-01S_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. */ int flasher_pin = 2; // GPIO2 for ESP-01S 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() { Serial.begin(115200); // can use Serial and flash Led at the same time on ESP-01S for (int i = 10; i > 0; i--) { Serial.print(i); Serial.print(' '); delay(500); } Serial.println(); 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() Serial.println(counter++); }