The micro:bit V2 is a pocket-sized computer that introduces you to how software and hardware work together. It has an LED light display, buttons, sensors, and many input/output features that you can program and physically interact with.
5x5 LED display
2 programmable buttons
Motion sensor (accelerometer)
Temperature sensor
Light sensor
Sound sensor and speaker
4 input/output rings
Bluetooth connectivity
The Maqueen is a compact educational robot designed to work with the micro:bit. It provides a platform for learning robotics, programming, and electronics in a fun and interactive way.
Two DC motors for movement
Ultrasonic sensor for distance measurement
Line-following sensors
RGB LEDs
Buzzer for sound output
Expansion ports for additional sensors
📖 In your workbook, label the components on the micro:bit V2 and Maqueen robot so that you know all of the features and where they are located.
A good overview of the BBC Micro:bit
A good overview of the Maqueen Robot
In this activity, we'll create a simple program that makes your micro:bit scroll your name repeatedly with a small pause in-between.
This will introduce you to basic programming concepts and the micro:bit programming environment.
Connect your micro:bit to your computer using a USB cable.
Open your web browser and go to https://python.microbit.org/v/3/
You'll see a blank main.py file ready for your code.
You will use a few of the built-in functions to complete this project. Let's give you a run down of each, and then see if you can make the program yourself. It should scroll your name, clear the screen, and then pause for a second before repeating.
from microbit import *
This imports all the functions from the microbit module, giving you access to the micro:bit's features.
while True:
This creates an infinite loop. The code inside this loop will repeat forever.
display.scroll("Your Name")
This function scrolls text across the LED display.
display.clear()
This function turns off all LEDs, giving us a blank screen.
sleep(1000)
This function makes the program wait for 1000 milliseconds (1 second).
Before uploading to your micro:bit, you can test your program using the simulator on the right side of the MicroPython editor. Click the "Run" button to start the simulation.
Click the "Send to micro:bit" button in the editor.
Follow the instructions to pair your micro:bit
Check to see if your code is running successfully on your micro:bit.
In this activity, we'll create a simple program that makes your Maqueen robot move in a square pattern.
This will introduce you to programming robot movements and using the Maqueen extension in MakeCode.
Ensure your micro:bit is securely attached to your Maqueen robot.
Put one of the 18650 batteries into the Maqueen robot.
Turn off the power switch on the Maqueen robot.
Open your web browser and go to https://python.microbit.org/v/3/
You'll see a blank main.py file ready for your code, and if not just press "Reset project"
Click on "Open..." in the left sidebar.
Select the maqueenplusv2.py file.
At the "Change files?" prompt, select the file icon, then select "Add file maqueenplusv2.py".
We'll write a program to make the Maqueen move in a square pattern. Here's the basic structure:
from microbit import *
from maqueenplusv2 import *
init_maqueen()
while True:
# Your code will go here
Notice that you can use regular Python code such as import and while True:
Let's break down the Maqueen-specific functions you'll need:
init_maqueen() Initializes the robot and adjusts the IR line sensors.
drive(speed) Drives the robot forward. Speed can be 0-255.
spin_right(speed) Spins the robot to the right. Speed can be 0-255.
stop() Stops all motors.
sleep(milliseconds) Pauses the program for the specified number of milliseconds.
Your task is to use the above functions and any other necessary Python code to make the Maqueen:
Move forward for 2 seconds
Turn right for 1 second
Adjust the turning speed so this completes an approximate 90 degree turn
Repeat this 4 times to complete a square
Unfortunately, the online MicroPython editor doesn't have a simulator for the Maqueen robot.
You'll need to download your program and test it directly on the robot. You will need to test the speed of the turn and adjust as necessary.
Click the "Send to micro:bit" button in the editor.
Follow the instructions to pair your micro:bit.
Once it has downloaded, unplug the USB cable.
Turn on the power switch on the Maqueen robot and see if your code works!