Friday, September 23, 2022

Making a shake alarm - Movement sensor with radio

What to know if something it´s being moved with a control remote? Then you can use this code. Both micro:bits will have the same code, when the micro:bit it’s moved then an alarm will sound, and an angry face will appear in both micro:bits:


This code uses a FUNCTION (it’s a set of commands that you add, you will find it under the ADVANCE section and FUNCTION). If you do not want to use this function but want to have the same result, you can do this:


Now, If you want to have two independent micro:bit, one that can send you a signal every time it’s moved ut you don’t want to have any sound or light on that micro:bit (for example, you don’t want to warn the thief if he has move the object, or you are tracing an animal and do not want to disturb it) and the other micro:bit would be a control remote in a different place and has a sound alarm, you will need to codes:

Code for sender:


Code for receiver: