case 04:Timer
Contents
7. case 04:Timer#
7.1. Our Goal#
Use our watch kit to create a wearable timer.
7.2. Material#
1 x Watch kit
7.3. Hardware Connection#
Assemble our watch kit directly just like the picture below.
7.4. Software#
7.5. Programming#
Step 1#
When start our program, create a variable
flag
and set its value to 0. When button A is pressed, delay time for 5 second. When button B is pressed, set the value of variableflag
to 1.
Step 2#
Create a
forever
loop and place an if statement under it. When the variableflag
equals to 1, then activate the function.Set time delay and play the built-in music
nyan
for once. Then set the variableflag
to 0.
Program#
Link of the whole program: https://makecode.microbit.org/_35iVK1WVe8ms
You can also download the program from the page below.
7.6. Result#
The watch can keep time precisely and play music.