[Microbit-Python] Microbit+Lego project

Andrew Stacey loopspace at mathforge.org
Sat Apr 1 12:07:02 EDT 2017


Hi all,

I just wanted to post a link to a video and some code relating to a 
project I've been working on using a micro:bit to control a Lego 
Mindstorms EV3 robot.  It uses ev3dev on the Lego brick, meaning that 
the entire code can be written in python of one flavour or other.

The project uses two micro:bits.  One is portable and it sends 
information about its state (accelerometer and buttons) via radio to a 
second micro:bit.  That second micro:bit is connected to the Lego brick 
via a USB cable and just relays the information received down that 
cable.  Finally, the EV3 reads that information and interprets it into 
instructions to drive the robot.

As part of this, I wrote a simple module for presenting the micro:bit 
information to the main script which can be used with other python 
programs - at my github repository (linked below) I have examples using 
PyGame and the python turtle library.  I'm sure it could be improved, 
but the aim was to make it so that students, say, could focus on what 
they wanted the micro:bit to control rather than fiddling with settings 
for serial ports.

I hope that this is of interest to some of you.  I'd like to acknowledge 
the help of this list in understanding the various bits involved. 
There's still plenty that's a bit rough at the edges, I'm sure.

Video: https://youtu.be/IQCpcFz_93M
Code: https://github.com/loopspace/microbit

Andrew


More information about the Microbit mailing list