How does Shake function work?
Start by initializing your Microbit and opening a new project in the Microbit editor.
on an LED or playing a sound.
Save your code and download it to In the editor, create a new function called "onShake". This function will be triggered whenever the Microbit is shaken.
Within the "onShake" function, add the code that you want to execute when the Microbit is shaken. This might include turning your Microbit.
Hold your Microbit in your hand and give it a shake. You should see your code execute in response to the shake.
Repeat step 5 as many times as you'd like to test your code and ensure that it's working properly.
How does Shake function work?
Start by initializing your Microbit and opening a new project in th... [more]