Micro:bit with R Pi (2) – Code to micro:bit!

Now to get the code onto the micro:bit.


This turned out to be easier than I expected.  I attached the micro:bit before starting up the R Pi. (I don’t know whether this matters but I thought it was better to have everything wired up beforehand.)

I took the code, you see above, from www.raspberrypi.org  resources about Getting started with the micro:bit.  I then saved it in a new folder called Mu Python and chose ‘Flash’ from the top menu to flash the code across to micro:bit.   As expected, when I pressed button A the message scrolled across the display, etc..  What I love, about the BBC micro:bit, is how easy it is to get the code onto the micro:bit.   After using some other types of microcontroller, that have required you to hold down buttons and choose exactly the correct time to flash the code, this is just so much more straightforward!

There are lots of images you can get it to draw automatically such as HAPPY and SAD faces and CLOCK faces. A full list of them is given here: micro:bit micropython .  Don’t forget to add a sleep()*  statement though e.g. sleep(500), so that your image stays on the micro:bit long enough for you to see it!

* sleep() times are in milliseconds.

4 thoughts on “Micro:bit with R Pi (2) – Code to micro:bit!

  1. Thanks Anne, looks like a good alternative to the Block Based editors.

    Do you know if there is way to wirelessly send notifications from the Micro:bit to a Raspberry Pi?
    I was hoping to be able to use a Micro:bit to remotely control a robot & had hoped to use Bluetooth to send instructions to the Pi when the Micro:bit was tilted.

    Liked by 1 person

  2. Reading the documentation microbit-micropython.pdf on page 71, it looks like there isn’t enough RAM available. I don’t understand about the radio module but maybe it can be used.


  3. Thanks Anne, That’s a bit of a shame as it makes the Bluetooth functionality of the micro:bit pretty much unusable for anything more than a simple Push Button -> Take Photo operation.

    I’ll have to look for another way to integrate with the Raspberry Pi.

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s