David Whale has developed the BitIO library. It essentially lets you code your Microbit in normal Python 3.
Last summer I created these resources for Micro:bit:
http://warksjammy.blogspot.co.uk/2017/04/cpc-ucreate-microbit-resources-all-in.html
These were a mostly micro python using MU IDE. Some involved using the serial connection from Micro:bit and a Raspberry Pi. This again built on top of the technical feats of David Whale.
Each program involved a Micro python program which sat on the Micro:bit and then a separate Python program that then interpreted the data sent by the Micro:bit. This was technically possible but elongated.
David has essentially stripped out much of the complexity. Now there is a generic hex file which sits on the Micro:bit. The only coding that you do is in Python 3.
Here are the steps to get a simple demo working:
1. Go to Davids github:
https://github.com/whaleygeek/bitio
2. Look on the far right of the webpage for a green box which says 'clone or download'. Then click 'Download Zip'. Then save the zip file to your Pi.
3. Using the file manager find the downloaded Zip file and extract it.
4. Now plug in your Micro:bit to the Pi. Go into the Bitio master folder and you will find a hex file called 'bitio.hex'. Copy this and paste it onto the Micro:bit. This should now be flashed.
5. Go to the Bitio master folder and find the src folder. You will see several examples. The one that we will test uses the accelerometer to control the position of the player in Minecraft.
6. The file is called 'tilt_mc.py' open this in Python 3.
7. Open Minecraft and create a new world. Press f5 to run it the Python script.
8. The following dialogue will display in the Python shell window:
No micro:bit has previously been detected
Scanning for serial ports
remove device, then press ENTER
9. So unplug the Micro:bit and press enter.
10. Next the following text will display:
scanning...
found 67 device(s)
plug in device, then press ENTER
11. Now press enter and the following text will display:
scanning...
found 68 device(s)
found 1 new device
selected:/dev/ttyACM0
Do you want this device to be remembered? (Y/N)
12. Press enter to confirm and the following text will display:
Your micro:bit has been detected
Now running your program
13. If you pick up your Micro:bit then and open Minecraft you should see the player move according to the direction you are tilting the Micro:bit.
https://github.com/ncscomputing/HpAnthologyV2/raw/master/Hackpack%20Anthology%20V2%200.3.pdf
i do have a problem in the pi step, i downloaded the file on SD but the pi is not opening on the computer shall i install the raspberian on it
ReplyDeletedid you download the zip file onto your pi and extract?
ReplyDeleteCan this be done on Mac?
ReplyDeleteOn the Java Minecraft in MAC yes
ReplyDeleteHi, I reallly like the idea of your project, but it doesn't work for me. I have a microbit V2 and when I try to flash the code, the microbit displays error code 529, outdated code. The makecode editor also doesn't recognize the file. Is there any way you could update the code?
ReplyDeleteHi
ReplyDelete9 months later than you posted. I will have a look over the coming months.