Simple egg timer with the Calliope Mini
Everybody has an egg timer in the kitchen, so why not build one with the Calliope?
First we need something that allows us to set the time. I went for the "shake" gesture, because I want to set the time with the two buttons. So in this case the placeholder "setting mode" is changed between "true" and "false". When changing to "false" the time should start to run, so we immediately remember the currently expired program time with the "Runtime" block.
Here the placeholder "setting mode" is set to "true" at program start, so that the program starts in this mode:
With the buttons the time is then increased (button B) or decreased (button A) in steps of 10 seconds. With button A we still make sure that the value is not smaller than the initial 10 seconds.
In the main loop of the program we can now calculate the remaining time (if the "setting mode" is not activated):
when the "remaining time" has expired, we play a few tones and show an animation of two images, as long as (by shaking again) the "setting mode" is not activated again.
In the "else" part (time has not expired) we show the remaining time:
If the "setting mode" is activated, we reset the time to 10 seconds and display it as long as the setting mode is active.
The egg timer is ready. The time can even be adjusted while the timer is still running.
This text as well as the image is published under a CC BY-SA 3.0 DE license. It was originally published in German by Daniel Havlik and translated into English by the Calliope team.