If you've done the Heart Monitor Project you would have seen how one micro:bit can send a radio message to another and get it to show an image. In that project the receiving micro:bit showed a heart image when it received messages. But what if we wanted the sending micro:bit to choose which image to show? This project will show you how to send an image using radio messages. The transmitting micro:bit sends the image when the A button is pressed and any receiving micro:bit shows that image.

There are 25 LEDs on the front of a micro:bit in a 5 × 5 grid. Each LED can get controlled using an X and Y co-ordinate. The X co-ordinate goes from left to right starting from zero, and the Y co-ordinate from top to bottom starting from zero:

Each LED can be represented with the numbers 1 (on) or 0 (off). In the above heart image the first row (where Y is 0) has LEDs that are off, on, off, on, and off. That can be represented as 01010. The second row (Y is 1) has all the LEDs on. That can be represented by 11111. Using these numbers all 25 LEDs can be described.

Try doing your own image. Draw a 5 × 5 grid on paper, fill out the squares you want lit and convert this to five numbers using ones and zeros. With a partner read out the numbers you calculated. They should be able to draw your image on a 5 × 5 grid without seeing the image.

Now you have a method to send an image using numbers. This can be programmed into two micro:bits.

### What you'll need

2 x BBC micro:bit (or more if you have them)

1 x Micro USB cable

1 x Computer or tablet

4 x AAA Batteries & 2 x Battery Holder (optional)

### Project walk through

• Start by choosing a radio group. If you are near other people working with micro:bits make sure to pick a number that no-one else is using!

• When button A is pressed the image data is sent using the radio. First a clear message is sent to tell the receiving micro:bit that a new image is being sent. Then a message is sent for each row containing the numbers calculated for the chosen image.

• When each message (image row) is received we need to work out which X and Y co-ordinate each number represents (make two variables for these). The ones and zeros in the mesage represent the X co-ordinates from 0 to 4. The Y co-ordinate is the same for each row. A loop block is used to go through the X values (for block in the Loop section). The LED in that location is turned on or off by checking if the number in the received string is a one or a zero (the char from block is in the Text section under Advanced).

• After each row the Y co-ordinate gets increased by one. If we got the special "clear" message then we start again at the first row (zero).

Download this program to two micro:bits and see if you can send the image from one to the other!

### Next steps

• Can you send a different image? Perhaps a face?
• Can you make the sending micro:bit choose different images to send? Use the A button to choose which image and the B button to send it.
• Is there a way to send the whole image in one radio message? Radio messages can only be 19 characters long so you'll have to change the way the image is sent.