arduino-timer icon indicating copy to clipboard operation
arduino-timer copied to clipboard

Issue with .in timer on RP2040

Open pike2k opened this issue 1 year ago • 0 comments
trafficstars

I want to create a shutdown timer for my RP2040 (Raspberry Pi Pico). I use V3.0.1 of your library together with earlephilhower's arduino core.

The .every example with a blinking led works fine. I cannot get the .in timer to work. The timer performs the function but does not respect the unit that I set. I have simplified as much as I can but the result is the same, any unit I set is not used by .in timer.

Here is my extracted simplified code:

bool toggle_led(void *) { digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // toggle the LED return true; // repeat? true } bool disable_out(void *) { digitalWrite(OUT_OFF, LOW); return true; // repeat? true }

auto timer = timer_create_default(); // used by blinking led, works auto shut_timer = timer_create_default(); // used by my shutdown timer

setup: timer.every(500, toggle_led); shut_timer.in(3000, disable_out); // this unit is not respected at all, but the timer performs the function.

loop: timer.tick(); shut_timer.tick();

pike2k avatar Aug 30 '24 22:08 pike2k