Its a well known fact that people of all ages should regularly drink water. This keeps hydration levels up and improves concentration in the workplace and classroom.
In this lesson students will design and code a drinks reminder. They will learn how to program an external vibration motor to work in conjunction with the micro:bit LED matrix.
- Learn how a vibration motor works.
- Create a system that helps people for everyday life in the workplace and classroom.
Download the Code
Click the button below to download the MakeCode editor code for this lesson. The hex file is contained in a zip folder.
Kindly refer to our download the code page for instructions on how to upload your code onto the micro:bit. Please use instructions set A.
This code can also be uploaded into the MakeCode editor.
- 1 x Connector Cables
- Connect the micro:bit to the Innovation board via the edge connector.
- Use the connector cables to connect the vibration motor to the ADC1 connector on the Innovation board.
- Connect the micro:bit to a computer via the microUSB cable.
- Go to the MakeCode website on your computer and open a new project.
Time to Code
What Will Happen
When the micro:bit is powered the vibration motor will vibrate for 1 second and then stop for 1 second. At the same time as the vibration the LED matrix will light up for the same period of time and will turn when the vibration motor turns off. This will repeat 4 times.
After the 4 repetitions the micro:bit will begin a countdown of 30 minutes. After 30 minutes the code will restart and the vibration motor and LED matrix will again vibrate and light up 4 times.
This code is in a forever loop so will continue whilst the micro:bit is powered.
Taking it Further
- Add other components to the drink reminder system.
- Create a timer setting so the time in between each reminder can be varied.
Keep in Touch
We would love to keep in touch with you and as a result aid you along your digital making journey.
Becoming a digital maker subscriber means you will receive exclusive offers and we will keep you up to date with new resources and kits, as well as upcoming events and workshops.
Let us know how your digital education journey is progressing. Send us pictures and videos of your awesome creations and use the hashtag below.