Microcontroller coder

About

Free demo: level 1 (5 challenges, on the Arduino Uno and the Raspberry Pi Pico). Levels 2 to 5 (PWM and sensors, timing and state, the LCD and servo, projects) and Free play are in the full version.

About this simulator

Write real Arduino C++ or Raspberry Pi Pico MicroPython and watch it drive a pre-wired kit: LEDs, buttons, a buzzer, a servo, an LCD and sensors.

How it works

Pick a board at the top: an Arduino Uno programmed in C++, or a Raspberry Pi Pico programmed in MicroPython. Both are wired to the same kit, so every challenge works on both, and you can learn one language and then the other.

  • Read the goal. Each challenge says exactly what the checker tests, and the Learn box shows the new code you need, with an example.
  • Write the code in the editor and press ▶ Run. The board runs it straight away: LEDs light, the servo turns, the buzzer plays (turn the sound on with 🔊) and the serial monitor shows what the code prints. Press the buttons (or the A and B keys), turn the knob and move the light and temperature sliders while it runs.
  • Check it. ✓ Check my code runs your program on a fresh board for several simulated seconds, pressing buttons and changing the sensors like a person would, and tells you what passed and what didn't.
  • Earn stars. One star for working, one for doing it without hints or the answer, and one for the bonus goal. Passing a challenge on any day keeps your streak going.
  • Your code is saved in this browser for each challenge and each board.

The kit

PartArduino UnoRaspberry Pi Pico
Board LED13 (LED_BUILTIN)"LED" (GP25)
Red, amber, green LEDs10, 11, 12 (220 Ω each)GP15, GP14, GP13 (330 Ω each)
RGB LED (common cathode)3, 5, 6GP10, GP11, GP12
Buttons A and B (to GND)2 and 7: use INPUT_PULLUPGP16 and GP17: use Pin.PULL_UP
Passive piezo buzzer8GP18
SG90 servo9GP22
10 kΩ knobA0GP26 (ADC0)
Light sensor (GL5528 LDR + 10 kΩ)A1GP27 (ADC1)
TemperatureTMP36 on A2the sensor inside the RP2040, ADC(4)
16×2 LCD, I2C backpack at 0x27A4 (SDA), A5 (SCL)I2C0: GP0 (SDA), GP1 (SCL)

How accurate is it?

Arduino Uno: your sketch runs on the same engine as our Arduino Uno simulator. The kit is a real breadboard circuit solved like SPICE does it, with datasheet values: a 16-bit int, 490 and 976 Hz PWM, 10-bit analogRead, serial at 10 bits per character, buttons that bounce for about a millisecond, and the LiquidCrystal_I2C library talking to the LCD byte by byte (its init() really does take just over a second). The Servo library takes Timer1, so analogWrite on pins 9 and 10 stops working once a servo is attached, and tone() takes Timer2, which stops PWM on pins 3 and 11, just as on a real Uno.

Raspberry Pi Pico: your program runs on a MicroPython interpreter in the page with the Pico's machine module: Pin (with pull-ups and pull-downs and irq), PWM (freq, duty_u16, duty_ns, with pins on the same PWM slice sharing a frequency), ADC (read_u16 from the 12-bit converter), Timer and I2C, plus time, random and the popular pico_i2c_lcd LCD library. The temperature sensor follows the RP2040 datasheet formula, and like the real one it is a little noisy.

What it doesn't do: timing is accurate to a few microseconds on the Uno, but MicroPython's speed is an estimate (a real Pico runs roughly a few hundred thousand simple lines a second). Error messages follow standard Python wording, which is close to MicroPython's but not always word for word.