Zumi will play four different notes depending on which quarter of the circle she is facing. To do this, we need to write if statements for four cases:
- If 0 degrees < angle AND angle < 90 degrees (First quarter)
- Else if 90 degrees < angle AND angle < 180 degrees (Second quarter)
- Else if 180 degrees < angle AND angle < 270 degrees (Third quarter)
- Else if 270 degrees < angle AND angle < 360 degrees (Fourth quarter)
Set up 4 if statements, the AND blocks, and the comparator blocks.
Since you will need to compare the same angle reading multiple times, create a variable at the top of the loop that will save the reading.
Finally, match the code to the outline written above and add four unique sounds!
NOTE: Notice, once again, that if you turn Zumi to the right, the values read by the gyroscope are negative. Therefore, the sounds will not play. If you turn it left more than a full 360°, the gyroscope will read angles larger than 360, and the buzzers will not play any notes. Look at the console for the printed values as you turn Zumi to figure out which notes should or should not be playing!