Micro:bit Assignment

by 1017310 in Circuits > Microcontrollers

252 Views, 0 Favorites, 0 Comments

Micro:bit Assignment

Step1.jpg

This Micro:bit is used to send either a smiley face or a sad face to another Micro:bit. It is for my Network Security Assignment. This task will be completed using the provided blocks in Tinkercad.

Supplies

You will need:

- 2 Micro:bits

Set Radio Groups

Step2 (set radio group).jpg

In order for the two Micro:bits to communicate with eachother, they need to be set to the same radio signal.

Clear the screen of any blocks, and drag out the 'on start' block. Under the 'Output' tab, you will find a 'radio set group'. Drag that out and place it within the 'on start' block. Pick a number. Do the exact same for the second Micro:bit.

Button a - :)

Step3 (button A).jpg

Under the 'Input' tab, drag out the 'on Button A pressed' and place it in your workspace. From the 'Basic' tab, drag out the 'show string' and place that within the Button A block. In this tutorial, we are sending happy and sad faces, but you can set it to show anything.

In the 'Output' tab, find the 'radio send string' and put that in the Button A block under the 'show string'. Place a 'wait 1 second' found in the Control tab under the radio send string. I chose to wait half a second, but you can decide for yourself what time you think is appropriate.

Finally, clear the screen. Do the exact same thing for the other Micro:bit. This step is for the Micro:bits to send signals to one another, and also show what you are sending on your Micro:bit.

Radio Received

Step4 (Radio received text).jpg

From the 'input' tab, drag out the 'radio received string' block and place it in your workplace. This block is telling the Micro:bit what to do when it receives a signal from another Micro:bit.

Place a 'show string' in the radio received block, and set it to whatever you made your other Micro:bit send, which in this case is a smiley face. Put in the wait and clear screen blocks.

Do this for the second Micro:bit.

Button B - :(

Step5 (button B).jpg

Now for Button B. Drag in the 'on button A pressed' again, and change the 'A' to 'B'. Follow a similar process to Button A, however this time we are sending a number instead of a string. This is so that the Micro:bit doesn't get confused on which signal it is receiving.

As usual, show the string that you want to send, wait around a second, and then clear the screen.

Do the same for the second Micro:bit.

Radio Received

Step6 (radio received value).jpg

From the input tab, now drag in the 'on radio received number'. Then follow the exact same steps as before - show the string you want to show, wait a second and clear the screen. Finally, do the same for the other Micro:bit. You now have two Micro:bits that can communicate with one another!