Flashing an LED is a bit of a no brainer on the micro:bit – the only hard thing is choosing which of the 25 LEDs!
It gets interesting with the ChickBot micro:bit driver board because there is a small piezo mini-speaker on the board that we can use the music commands to play notes on it.
So, if you build this script, download it to your micro:bit, plug it into the ChickBot, power up and press the A button, we’ll see the LEDs flash and hear a buzz. This basic exercise will get us warmed up for bigger things.
You’ll find the blocks you need on the left hand side palette.
- ‘On button A pressed’ is in Input.
- ‘Plot x y’ is in LED
- ‘Play tone’ is in Music
- ‘Unplot x y’ is in LED
Click on the palette name and then click the command you need. Take your time and find out what programming blocks there are. You drag & drop the blocks around into place. If they link up in the way you don’t like, you can pull them apart to put them together as you need.
Then click the Compile icon, copy the program over from the Downloads folder to the micro:bit drive. Pop the micro:bit in to your ChickBot, put the power jumper on, press button A and you’ll see the middle LED coming on and hear a short tone. You don’t have to unplug the USB lead if you don’t want to – it’s perfectly OK to leave the micro:bit plugged in to your computer and have it plugged in to the ChickBot with it’s power jumper in place.
Don’t forget, there is an intro to the micro:bit on the setup software page.
Once you’ve got it going you can play around with which LED you turn on – x & y values range from 0 to 4 – computers start counting at 0, something to get used to.
You can also change the note that is played and how long for. And you can duplicate the blocks so you can have different LEDs coming on and more than one note being played.