Audio and compass
This section will try to integrate the speech library and compass to assist with the direction information. The speech library will convert the heading into audio, and we have already observed the working of the heading function in the previous example. The code will be as follows:
from microbit import * import speech import music while True: direction = compass.heading() print(direction) if direction < 35 : speech.say(“North”) display.scroll(“N”) music.play(“E8:4”) elif direction == 90: speech.say(“East”) display.scroll(“E”) ...