Micro:bit Bluetooth Challenge
- 2 minsCan you build Scissor-Paper-Rock game using micro:bit and Bluetooth?
This post is the challenge for the Race Condition badge at Arctic IoT Challenge. The description for the badge is as follows:
At random, the jury will present a challenge. Timeboxed to one hour, the first team with a working solution gets all the points.
This time I am designing the challenge, so here it comes:
The Challenge
We want you to simulate a popular Scissor-Paper-Rock game using micro:bits. Each team gets two devices.
- On shake the micro:bit should pick a random shape (scissors, paper, or rock) and show it using LED array on the device
- The two devices should connect and send the data over to each other
- The opposite device compares then its shape to the one received and decides whether it won or lost
- Each of the two micro:bits shows then “Won” or “Lost” on the LED array.
The Building Blocks
Connecting to a micro:bit
Connect the micro:bit to your computer using a micro USB cable. It should appear as a USB disk on your machine.
Editor and Language
Yan can use Python and the editor here: http://python.microbit.org/editor.html.
After you are done writing the code, click Download, and you will get a binary file you will be using in the next step. Check out the help section for more information.
Python documentation for the API can be found here.
Deploying to a micro:bit
Copy the binary *.hex file from the previous step on to the micro:bit, just like you would copy to any USB drive.
Sending Data Between micro:bits
Now, over to connecting micro:bits and sending data over. Take a look at the example below. Make sure to change group=1 to a number between 0 and 255. Both chips should belong to the same group to connect with each other. You will be assigned a number.
The Scissor-Paper-Rock Game
Have a look at the simple implementation of the game. You will need to translate it to MicroPython and extend.
Extra
[Spoiler alert!] The winning team gets to submit their code to this GitHub repo.