/* Blink_lp_timer_debug_GT832E_01 Turns on an 'led' on/off at 10Hz (c)2022 Forward Computing and Control Pty. Ltd. This example code is in the public domain. */ #include int led = 14; // Use P0.14 has the 'led' pin bool ledOn = false; lp_timer ledTimer; const unsigned long DELAY_TIME = 50; // ms == 10Hz void setup() { Serial.setPins(11,12); // remap Rx to P0.11 and Tx to P0.12 Serial.begin(115200); 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'); } }