Introduction
The micro:bit is foremost an educational aid with the stated aim of providing an introduction to programming concepts for school aged children. It comes loaded with "goodies" and is easily programmed with graphical languages; think MakeCode and Scratch.
The porting of MicroPython to this device opens up a much bigger world. It allows the move away from the limit of onboard hardware extras to an opportunity to become a more general microcontroller platform like Arduino, ESP32 and pyboard.
It becomes possible to interface the micro:bit with all sorts of other devices such as sensors, chips, input & output hardware by developing drivers in MicroPython and exposing as public libraries (modules) for everyone interested in following along.
The microbit Module
The microbit module, which by its name indicates it is unique to the micro:bit, provides direct access to most of the important things on the micro:bit board. How MicroPython interacts with the hardware and firmware of the micro:bit is described in the next webpage of this series.
The official MicroPython documentation for the micro:bit (easily found with an Internet search) covers the microbit module quite well. However it concentrates on the syntax but mostly provides no code examples.
The following pages of this website give a brief syntax overview of the various classes and objects exposed in the microbit module while providing code examples (where relevant to the scope of this website) that have all been run on the micro:bit. Included are pages specifically referencing the microbit module that cover:
- The small collection of stand-alone functions.
- General Purpose Input/Output (GPIO) pins.
- PCB hardware (buttons, display, speaker, radio stack, microphone, accelerometer, magnetometer)
- Serial communication protocols supported by the hardware (UART, SPI, I2C)
While mentioning most of the micro:bit's hardware, the strong emphasis is on the functionality within the microbit module that will aid in interfacing other components to the micro:bit.