#How to Code a 10 Minute Timer
By following this #How to guide, you will obtain a "10 minute timer" that is portable, adjustable, and can be placed anywhere.
10 Minute Timer Materials Needed:
1. CyberPi Go Kit (or mBot2)
2. Computer/Smartphone/Tablet with our mBlock software installed
CyberPi is an educational single-board computer that integrates various sensors and features, enabling programming and creative practices. You can use the display and buttons on CyberPi and the programming capability of CyberPi to code a 10 minute timer.
Let's start!
Download "mBlock" and connect CyberPi to your computer via a USB cable (or connect it to your phone or tablet via Bluetooth).
# Introduction #
10 Minute Timer Function Design Idea:
1. Press button A to start the countdown.
2. Reset the 10 min timer, like setting a new starting point for the countdown.
3. CyberPi repeatedly displays the time code (the time should be in integers) until the time reaches zero (the timer counts down from a set duration).
4. CyberPi emits a sound when the time is up.
5. The time code loops back to the initial state before you press button A.
10 Minute Timer Function Design Idea:
Building upon the existing setup, add an "if-then" function to display the corresponding lighting effects with the LEDs on CyberPi at specific intervals of the remaining time.
# Make A Note #
How to code and set a 10 minute timer?
Part I: Design a Countdown Function
--CyberPi repeatedly displays the time code until the 10 minute timer reaches zero.
Part II: Add LEDs to display the remaining time
--Building upon the existing setup, add an "if-then" function to display the corresponding lighting effects with the LEDs on CyberPi at specific intervals of the remaining time.
Part III: Display the countdown in minutes and seconds on your 10 min timer
--Minutes: remaining time divided by 60
--Seconds: remainder of the remaining time divided by 60