Did you know that your body can conduct electricity? In fact lots of things can conduct electricity, some better than others.
In this project we're going to create an electrical circuit using your body and some fruit and vegetables (which also can conduct electricity) to make your Microbit create some music.
Don't worry this is safe to do, as the amount of electricity we'll be using is very, very low.
For this project you will need:
Go to the makecode.microbit.org website and create a new project.
Go to the Makecode.com Microbit website using the link below and click on the 'New Project' button underneath the 'My Projects' heading.
Install the micro:bit app on your iPad or tablet.
Open the app, tap 'Create code' and then create a new project.
Microbits have 3 "pins" on them (P0, P1 & P2) that can be used with the GND (ground) pin to create circuits. In a later step we will be attaching the crocodile clips to these pins but for now lets add some come to program what will happen when the circuit is completed.
Add the following code to program P0. You can choose any note or icon you want.
basic.forever(function () { if (input.pinIsPressed(TouchPin.P0)) { music.playTone(262, music.beat(BeatFraction.Quarter)) basic.showIcon(IconNames.Happy) } })
Add the following code to program P1. You can choose any note or icon you want, just make them different to P0 and P2.
basic.forever(function () { if (input.pinIsPressed(TouchPin.P0)) { music.playTone(262, music.beat(BeatFraction.Quarter)) basic.showIcon(IconNames.Happy) } if (input.pinIsPressed(TouchPin.P1)) { music.playTone(392, music.beat(BeatFraction.Quarter)) basic.showIcon(IconNames.Angry) } })