Discover Arduino Projects
Hundreds of projects from beginner to advanced — schematics, code, and videos.

mBot First Drive: Forward, Backward, Right and Left
Press the button on the mBot's board and the robot does the four basic moves in turn: it drives forward, comes back, turns right on the spot and turns left. Each move is a function of its own. No extra parts are needed. In a turn the two wheels spin in opposite directions; the TURN_MS time sets the angle.

mBot Square Drawing Robot: Four Sides with a Loop
Press the button on the mBot's board and the robot draws a square on the floor: it drives along one side, makes a quarter turn to the right on the spot and repeats this four times. It ends where it started. No extra parts are needed. The SIDE_MS time sets the side length and the TURN_MS time sets the turning angle.

mBot Speed Levels: Slow, Medium, Fast
Press the button on the mBot's board and the robot drives forward and back at three speeds: slow first, then medium, then fast. The time is always the same; the higher the speed, the farther the robot goes. No extra parts are needed. The speeds sit in the SPEEDS table: 100, 170 and 255.

mBot Night Light: LEDs That Turn On in the Dark with the Light Sensor
The light sensor on the mBot's board measures the ambient light. When it gets dark the two RGB LEDs light up warm white; when it gets bright they go off. No extra parts are needed. The on and off limits differ (300 and 450), so the lamp does not flicker at the edge. The reading is printed to the Serial port.

First Program with micro:bit: Beating Heart
Upload your first code to the micro:bit: a big and a small heart take turns on the LED display and beat with a double thump like a real heart. No wires or extra parts; just connect the board to a computer over USB. display.show shows an image and sleep makes the program wait.

micro:bit Name Badge: Scrolling Text on the LED Display
Your name scrolls across the micro:bit's LED display from right to left, then a happy face shows and it all starts again. Clip the board on with a battery pack and it becomes a digital name badge. display.scroll moves the text; no extra parts are needed.

micro:bit Mood Badge: Faces with Buttons A and B
Button A shows a happy face, button B a sad one and both together a surprised one; after five seconds without a press the micro:bit falls asleep. is_pressed reads a button and if / elif makes the choice. No extra parts are needed.

Ticklish micro:bit: A Board That Giggles When You Touch the Logo
Touch the gold logo above the display: the micro:bit giggles and its face wiggles left and right, then calms down when you take your finger away. pin_logo.is_touched senses the touch and audio.play plays the sound. No extra parts are needed.

micro:bit Digital Dice: Shake to Roll
Shake the board: the dice rolls for a moment, then stops on a random face from 1 to 6. The accelerometer feels the shake (was_gesture) and random.choice picks the face. No extra parts are needed.

micro:bit Pocket Doorbell: Ding Dong
Press button A and the onboard speaker plays a two-note doorbell. Button B plays a built-in tune; a note shows while it plays and a house while it waits. music.play plays the notes. No extra parts are needed.

micro:bit Spirit Level: A Dot That Slides as You Tilt
Tilt the board and the lit dot slides toward the lower edge like a marble; when the dot is in the middle the surface is level. The accelerometer measures the tilt (get_x, get_y) and set_pixel lights the dot. No extra parts are needed.

micro:bit Clap Lamp
Clap once and the whole LED display lights up like a lamp; one more clap turns it off. The onboard microphone hears the sound (was_event) and set_threshold sets the level. No extra parts are needed.
