Instead of turning off the LED, you could of course give it a different color.
Or, instead of the coloured LED, you can use the display to indicate a tilted position.
- So far, the Calliope has checked its position only once. Directly after program starts.
With a loop you make sure that it is checked again and again.
- You can also install a warning tone and let a red LED light up longer, so that errors can be recognized more clearly.
You can already play your Calliope game.
The next tasks will explain how to use angles to determine the position of the Calliope more precisely and thus increase the difficulty.
With the gyroscope you can also measure how many degrees the calliope is tilted.
- Switch off the LED if the Calliope is tilted less than 20° forward or backward.
- For this we need the X-value. If you combine it with the absolute value, you don't have to differentiate whether the calliope is tilted forwards or backwards.
Now we also have to check the tilting to the right and left.
We measure this with the Y-value. If the calliope is lying on the table, the value is -179° or +179°.
The LED should also be switched off if the absolute value is greater than 160°.
If you use a smaller number (but a minimum of 0) instead of 20 and a larger number (but a maximum of 179) instead of 160, the game becomes more difficult.
This text as well as the images are published under a CC BY-SA 3.0 DE license popup: yes. It was originally published in German popup: yes by TüftelAkademie popup: yes and translated into English by the Calliope team.