After learning the basics of wiring the ‘breadboard’ and programming the micro:bit we experimented with a few more features including using a potentiometer, accelerometer and setting up communication between devices.
The simple program shown below uses the built-in accelerometer to control motor speed of a fan in relation to tilting movement of the microcontroller on the breadboard.
Here is a demo of the code working…
Getting microcontrollers to talk to each other
We then set up a program to get the micro:bits to talk to each other – sending a signal to turn another fan on and off. The code below tells the microcontroller to send the letter ‘F’ and a value of ‘1’ to any other microcontrollers in the group when button A is pressed. The ‘on radio received’ code tells it to turn the fan on when it receives a value of 1 from another microcontroller in the group, and turn it off when it receives a zero.
Programming ZIP LEDS
The ZIP LED is an ‘addressable’ LED light, which means you can send code to it (like addressing mail a ‘zip’ code, geddit?). We first tried some code to turn on one of the lights, then coded a rainbow version. Because the LEDs are based on RGB colours, you can program the lights to show any colour if you know its RGB code.