/* Blink_lp_timer Turns on an LED on for one second, then off for one second, repeatedly. (c)2018 Forward Computing and Control Pty. Ltd. This example code is in the public domain. */ #include // Pin 13 has an LED connected on most Arduino boards, including NanoV2 int led = 13; bool ledOn = false; lp_timer ledTimer; const unsigned long DELAY_TIME = 1000; // ms == 1sec // the setup routine runs once when you press reset: void setup() { Serial.begin(115200); // initialize the digital pin as an output. pinMode(led, OUTPUT); ledTimer.startTimer(DELAY_TIME, handleLedTimer); Serial.print("startup() completed at "); Serial.print(millis()); Serial.println("ms"); } void loop() { sleep(); // just sleep here waiting for the timer to trigger Serial.print("loop() woke up at "); Serial.print(millis()); Serial.println("ms"); } void handleLedTimer() { ledOn = !ledOn; // toggle state if (ledOn) { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) Serial.println('H'); } else { digitalWrite(led, LOW); // turn the LED off by making the voltage LOW Serial.println('L'); } }