You always need to have the
If you use random, music or radio in your program you need to remember to also import them at the top of your program as well
sleep tells the Microbit to stop doing anything for as long as you tell it
temperature gets the current temperature
running_time gets the amount of time since the Microbit started running the program
Show a happy face if button A is being pressed or show a sad face is button B is being pressed.
randrange picks a random number in the range
random.choice picks a random thing out of a list of things
When you have more than 1 Microbit, you can send and receive messages using the radio.
If there are other Microbits using the radio around you, make sure that you are using a different channel number (using
Setting wait=False tells the Microbit to play the music and keep going with the rest of the program, otherwise it will wait until the music is done
Setting loop=True, will keep looping the music over and over instead of just playing once
This code checks what the current gesture is that is happening to the Microbit and shows a sad face if it is a shake
Micro:Bit Cheat Sheet by aleciko
Cheat sheet for the BBC Micro:Bit