Flip a virtual coin and show head or tail when the micro:bit is shaken.
The program starts with a rule that uses
a shake event and 2-face dice is cast. The result is stored in variable X
.
- when shake, do set variable X to random number between 1 and 3.
- when shake, do play an arpeggio using the music tile .
The next 2 rules match the value passed in variable X
and display a different symbol for each value, 1 or 2.
- when variable
X
changes to 1, do show head image.
- when variable
X
changes to 2, do show tail image.
improvement ideas
- clear the screen before showing the new symbol