Toggle timer countdown

I am looking for a simple way to implement a timer where the first button press is a 20-minute countdown. The second button press switches to a 40-minute countdown, increasing the green LED brightness.

I think I can do this with an if-else statement, but how do I cancel the 20-min timer?

Is there a way to see the current timer countdown time remaining in the logs?

Thank you,
Mike

You’re on the right track. To cancel the delay, either:

  1. Replace Delay with Wait (it will be automatically cancelled on ce the button is pressed again), or;
  2. Add a “Cancel Delayed Actions” on the first line.

After the last line you have there, you just need to add “ELSE” with the delay / wait being 40 minutes instead of 20 before the 2 other commands (setLED and Off). Remember to add an END-IF at the last line.

If you want to change the brightness of the LED, you could:

  1. Create a brightness variable which is first set to 30, then
  2. Add a repeat until brightness <=5 action that substracts 5 to the variable on every iteration, and then “setLED(5,’green’,%brightness%)” followed by End REP.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.