Thursday 14 December 2017

Remote control your smartphone camera with a micro:bit

Using your micro:bit as a remote control for the camera on your smartphone is easy.

I wrote a quick MakeCode application which lets you take a photo by pressing button A on the micro:bit and have shared it at this URL: 





The "Tell camera" block is in a special package called Devices. You need to add it to your MakeCode project. You do this by going into the Advanced section at the bottom of the list of block categories on the left, click Advanced, then Add Package and then select Devices. When it asks if you should remove the Radio package,confirm that it should.

The procedure you should then follow with an Android phone is this:

1. Download the hex file from MakeCode and copy it to a micro:bit. I used USB for this. 

2. In Android, go into Settings/Bluetooth and if the micro:bit is listed as paired, "Forget" it. You need to forget pairing every time you flash a hex file as the pairing details get deleted from the micro:bit, leaving the phone thinking it's paired and the micro:bit thinking it is not. They both need to think they are paired or they both need to think they are not paired otherwise Bluetooth communication will fail, with one side trying to perform encrypted communication and the other having no idea what's being said to it!

3. Launch the official Samsung micro:bit app. Select Connect and then PAIR A NEW MICRO:BIT.

4. Put your micro:bit into pairing mode using by holding A+B and pressing and releasing the reset button, all the time keeping A+B pressed. When "PAIRING MODE" appears, you can release A+B.

5. Complete pairing, following the instructions on the smartphone app.

6. Press reset to restart the micro:bit with the new code. You should briefly see a smiley icon appear and then vanish.

7. Now in the Connect screen, connect to the micro:bit you just paired (select it in the "Connect to previously paired micro:bit" section. After a short delay you should see "C" on the micro:bit. This means a Bluetooth connection was established.

8. Now press button A. This should cause your phone to open the camera app, count down 6 seconds and then take a photo.

Have fun.



2 comments:

Note: only a member of this blog may post a comment.