BBC micro:bit
Gestures
Introduction
The term 'gesture' means moving the micro:bit in a particular way. For some of the scripts, the 'shake' gesture is a trigger for some meaningful action, like rolling a die or displaying a rock, paper, scissors shape. For a movement to be a gesture, it needs to be easily repeatable by a user and something that we can recognise on the micro:bit.
There are some built-in gestures that you can use.
On Shake
We used this as a trigger for the die rolling in the Shaking All Over page. Moving the micro:bit from side to side triggers the event.
The Others
Here is a script that you can use to see how you make the other four built-in gestures in the block editor.
When you first flash this program to the micro:bit, assuming you are holding it flat, you should see the T pattern. Tilting the micro:bit towards or away from you should trigger the logo events, where you will see an arrow. Turn the whole micro:bit upside down and you will trigger the screen down event.
Challenges
- The shake event is pretty good as a trigger for something in a program that only really needs one input. Anything where you get a random outcome is good when it is done that way. Simply scrolling through a list of images by shaking is cool too. Making a spare die for your board game is pretty cool too.
- You could use the 5 events as 5 different inputs for a program. These could be musical notes, different patterns on the matrix or written as part of a chain of events that the user repeats to unlock some sort of secret.