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

First Program with mBot: Light Up the Onboard RGB LEDs
Upload your first code to the mBot with the Arduino IDE. The two RGB LEDs on the robot's board (mCore) light up red, green and blue together, then the right one turns yellow, the left one purple, and both go off. No wires or extra parts are needed; just connect the mBot to the computer over USB. setColor picks the color and show sends it to the LEDs.

Color Fade with mBot: A Rainbow on the RGB LEDs
The two RGB LEDs on the mBot's board fade smoothly through the colors of the rainbow: from red to green, green to blue and blue back to red. The left LED runs a little ahead of the right one on the color wheel, so the two always show different shades. No extra parts. A single number (0-255) holds the place on the wheel, and the code turns it into red, green and blue values.

Change Colors with the mBot Button: A New Color on Every Press
Every press of the button on the mBot's board moves the two RGB LEDs to the next color: red, green, blue, yellow, purple, cyan, white and off. Holding the button does not change the color again; one press is one step. No extra parts are needed. The button is read as an analog value on pin A7: close to 0 while pressed, up at 1023 when released.

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.
