Step 1: Make it
What is it?
Make an alarm that lights up and plays a tune when your micro:bit is moved.
These two videos show you what you'll make and how to code it:
Introduction
Coding guide
How it works
- In this project you'll make an alarm that goes off when you move your micro:bit. You could hide it inside or place on top of something precious, or put it in a bag and use it as a reminder to check you have everything you need when you go out.
 - Your micro:bit contains an accelerometer which measures forces. The accelerometer detects a shake gesture and shows a pattern on the LED display.
 - It also plays a warning melody. To hear the melody, use the MakeCode simulator or attach headphones to pin 0 and GND. You can also use an amplified speaker.
 - Press the reset button on the back of your micro:bit to clear the screen and make it ready for using again.
 
What you need
- a micro:bit
 - MakeCode or Python online code editor
 - battery pack
 - optional speaker and crocodile clips
 
Step 2: Code it
Step 3: Improve it
- Change the face icon to your own picture, using the 'show leds' block in MakeCode or the Image instruction in Python.
 - Replace the melody with your own creation or a tune you love.
 - Make it more sensitive using direct readings from the accelerometer instead of the shake gesture.
 
This content is published under a Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) licence.


