Skip main navigation

Challenge 1: Detect input, create output

Detect input, create output
18.5
Here’s one of our first challenges with the micro:bit. We’re going to create a piano that will react to our touch and play music. So we’re going to start by connecting a speaker
29.8
to the micro:bit. So using these clips to connect the zero pin and the ground pin to a speaker. The speaker has to have its own power source. It could be just a set of headphones. So you just need this 3.5 mill jack. So add one crocodile clip to the end of the jack, and another to the tip, like so.
56.4
And then power up your micro:bit. So this speaker has its own battery. I’m just going to turn it on and run my test code. So my test code is when I press A, it’s going to play a tune. This is really loud.
78.2
OK. Brilliant. So the next part of our code is that when I touch pin one it will play a middle C. So I physically am becoming part of the program. Because I am conductive the electrical signal will travel through my body. It won’t be dangerous or anything. But it is quite fiddly. So I need to hold down ground with one hand, and I’m going to try and hold down one with the other. So you can see how fiddly this is. [BEEPING SOUND] Oh, there it is. That was one. [BEEPING SOUND] So– [BEEPING SOUND] That’s middle C. [BEEPING SOUND] And here we have– [BEEPING SOUND] High C.
123.1
[BEEPING SOUND] So because this is a bit fiddly what you can do is add more clips to your circuit and touch them. [BEEPING SOUND] That makes it– [BEEPING SOUND] –a bit more reliable. And what you can do is add more conductive things to this, which I’m going to show you in a minute. So we’re going to add some tinfoil and some fruit to continue with our circuit.
156.2
So again, to continue our circuit we’re going to connect the pins to these bits of tin foil, because tin foil is conductive. I’m going to add this to pin two. It’s getting a bit squishy in here. So I’ve just folded the tin foil over several times to try and get a good connection. So let’s see. I have to hold ground and then– [BEEPING SOUND] [BEEPING SOUND] [BEEPING SOUND] So you can see how I’m creating– [BEEPING SOUND] –like a piano. We could put these on the floor– [BEEPING SOUND] –and create like a floor piano. But what’s even more fun– other things that are conductive– some forms of Play-Doh, and fruit.
206.3
We’re going to try and dig this right in to the apple. Quite far in. And then hold down ground. [BEEPING SOUND] Yay. [BEEPING SOUND] So it just needed to be really deep into the apple. [BEEPING SOUND] And there is my fruit piano. [BEEPING SOUND]
This article is from the free online

Build a Physical Computing Prototype

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education