MicroPython Mix

Mark Lucking
4 min readAug 28, 2019

I got a gig to teach coding and robotics over the summer. Coding and robotics based around LEGO mindstorms platform, running text based code; Python.

It was to be a baptism by fire, and an opportunity in which I found myself forced to flip the classroom. A popular idea that has come to fore in recent years. The only way to make it work in my case.

I say flip, I wasn’t quite there. I couldn’t give the students homework, only classwork. The snag, the age ranges. The youngest would be ten. The oldest sixteen.

I ended up writing two dozen tutorials for the students to complete. They needed to be simple. They needed to have some end goal. They needed to be self explanatory. They needed to be understandable by a ten year old, and challenging enough for a sixteen year old.

Beyond the tutorials I had set out challenges, problems the students would try and solve using their new coding knowledge.

Here is a list of links to the tutorials I ended up creating. I have I must confess rewritten some of them and I need to add a few more still.

Brick Buttons. The code you need to be able to “do things” when the press the buttons on the LEGO brick.

Brick Lights. The code you need to change the lights on the brick when you press those buttons.

Simple Simon I. Combining the code in brick buttons and brick lights to build a simple game.

Simple Simon II. Continuation of the code to build that game.

Brick Sound. Continuation simple Simon game, adding some sound to the mix.

Brick Images. Continuation simple Simon game, adding some images to the mix.

Brick Images & Sound Review. A step back to look at the options for sound and images.

Brick Motors. Using the buttons to make your robot move.

Brick Sensors, the gyro. A simple introduction to the gyro. A little more depth with the motors.

Brick Motors II. A more in depth look at the commands to get your robot to move.

Brick Motors III. An introduction to the robotics science known as odometry and some built in commands to use it like DriveBase.

PID Controller using the gyro. Making use of the lessons learnt in the previous tutorials with a goal in mind, correcting drift; driving in a straight line.

Programming the LEGO remote. An rest byte from PID Controller concept. Controlling your robot with the LEGO remote.

More Sensors, the colour one. A first look at how to use the colour sensor.

Edge Detection, using that colour sensor. A practical look at how you can actually use the colour sensor.

A iOS remote. A diversion again, this one focusing on using you iPhone or iPad to control your robot using a script that works with this app.

Line Squaring, using colour sensors. A tutorial that focuses on using the colour sensor to square your robot on a line. Different from all of the others to date, since it also talks about engineering choices.

Ultra Sonic vs Infra Red vs Motors. A tutorial that looks at using one or more of three methods to measure distances.

Touch sensors and a timing. A short tutorial that covers touch sensors and the stopWatch class in MicroPython.

And that is it for now. I will be doing some tutorials on other sensors like the infrared, ultrasonic and return to the gyro in come weeks.

--

--

Mark Lucking

Coding for 35+ years, enjoying using and learning Swift/iOS development. Writer @ Better Programming, @The StartUp, @Mac O’Clock, Level Up Coding & More