Guide · MicroPython and the micro:bit
MicroPython and the micro:bit – Learning Guide
In this unit we program, with text in MicroPython, the same micro:bit that you programmed with blocks in MakeCode in grades 5 and 6.
Every lesson has a link to the same topic in MakeCode, so that you can compare the blocks and the code. At the end we connect the micro:bit with the computer and graphics.
- Grades 6–8
- Thonny or python.microbit.org
- sensors and radio
Some lessons linked below are available only in Serbian for now. They are marked (SR).
1 Basics
The LED matrix, buttons, loops and variables.
Introduction to MicroPython (SR)
Learn the basics of MicroPython for the micro:bit: the LED matrix, the first programs and loops.
Open lesson →LED matrix – text and images (SR)
Learn how to show text and images on the micro:bit LED matrix using MicroPython.
Open lesson →Buttons A and B (SR)
Learn how to use buttons A and B on the micro:bit in MicroPython.
Open lesson →Loops and working with time (SR)
Learn how to use loops and the sleep() function in MicroPython on the micro:bit.
Open lesson →Variables, lists and functions (SR)
Learn how variables, lists (arrays) and functions are used in MicroPython for the micro:bit.
Open lesson →Random numbers and algorithms (SR)
Learn how random numbers (random) and basic algorithms are used in MicroPython.
Open lesson →2 Sensors and actuators
Acceleration, tilt, compass, temperature, light and external parts.
Sensors: acceleration, tilt, pedometer (SR)
Working with the micro:bit sensors in MicroPython: accelerometer, tilt, movement and a simple pedometer.
Open lesson →Compass and temperature (SR)
Learn how the compass and the temperature sensor of the micro:bit are used in MicroPython.
Open lesson →Additional sensors and actuators (SR)
MicroPython additional sensors and actuators: micro:bit GPIO, servo, ultrasonic sensor.
Open lesson →3 Radio and projects
Communication between several devices and bigger projects.
Radio communication (SR)
Learn how micro:bit devices communicate wirelessly with the radio module in MicroPython.
Open lesson →Radio projects and games (SR)
Learn how to create mini projects and games with radio communication on the micro:bit using MicroPython.
Open lesson →Mini projects (SR)
Apply your MicroPython knowledge in practical mini projects and games on the micro:bit.
Open lesson →4 The micro:bit and the computer
A serial connection: data from the sensors controls graphics on the computer.
A serial connection with the computer (SR)
Learn how the micro:bit in MicroPython sends data to the computer through serial communication.
Open lesson →Project: a visual tilt controller (SR)
Learn how to make a visual tilt controller with the micro:bit and MicroPython.
Open lesson →Processing 4 – problems and choosing a path (SR)
Find out why Python Mode can cause problems in Processing 4, what the alternatives are and whether it is better to use py5.
Open lesson →Installing py5 (Windows and Linux) (SR)
A step-by-step guide to installing the py5 library.
Open lesson →micro:bit → py5 over the serial port (SR)
Connect the micro:bit and py5 with serial communication.
Open lesson →