Getting Started with MicroPython and the SparkFun Inventor's Kit for micro:bit

Pages
Contributors: LightningHawk
Favorited Favorite 5

Introduction to MicroPython

Using MicroPython

MicroPython is just an interpreter, so it does not include a space to write and edit code. Luckily, there is an editor we can use to write our Python code. Before you get started, you'll need to download Mu. Mu is a simple code editor for beginners that runs on Windows, OSX, Linux and Raspberry Pi.

A major benefit of using MicroPython is the interactive REPL. REPL stands for Read-Evaluate-Print Loop, which is a very long way to say you can execute code live without compiling it first and then uploading it after.

The applications for Python are extensive, and the advantage to using Python over other programming languages include interacting with other languages and platforms, third-party modules, extensive support libraries, user-friendly data structures and, of course, it's open source.

Some known issues with using Mu and micro:bit currently are not being able to import third-party modules [1], not being able to use interrupts, and not having a decent way to map numbers of one range to another. Since importing third-party modules is not supported, we will be copying and pasting the source code in the current Mu MicroPython file. As with learning any new language, Python requires time, patience, self-study and a lot of examples! Keep at it, and we will be here to help you along the way.

MicroPython Project Files

To download all of the files needed to follow along with all of the experiments, click the button below from the GitHub repository..

Software Options

To use MicroPython with the micro:bit, there are a few different options.