Arduino simulator
Write Arduino code on the right and press ▶ Run. Your sketch runs on a virtual Arduino Uno: LEDs light up, the servo turns and the buzzer beeps. Press buttons and turn knobs on the board while it runs. Stuck? Use Step to run one line at a time, or slow motion to watch the highlighted line, the pins and your variables change.
What makes this Arduino simulator different
- Step through your code. Run one line at a time or in slow motion, with the current line highlighted, so you can see exactly what the Arduino is doing and when.
- See every pin over time. The pin timeline works like a logic analyser: blinks, PWM duty cycles, servo angles and buzzer tones are all drawn as they happen.
- Missions that check your code. Each mission tests your sketch automatically by pressing the buttons, turning the knob and moving objects for you, then explains in plain English what still needs fixing.
- Errors you can understand. Missing semicolons, undeclared variables, a button without
INPUT_PULLUP,analogWriteon a pin without PWM, orSerial.printbeforeSerial.beginare all explained, with the line number. - Works on a phone and offline-friendly. No account, no download. Share your sketch with a link.
The Arduino Uno pins
Pins 0–13 are digital: each can be an OUTPUT (0 V or 5 V) or an INPUT. Pins marked ~ (3, 5, 6, 9, 10 and 11) can also do PWM: analogWrite(pin, 0–255) switches the pin on and off about 490 times a second, so the average voltage, and an LED’s brightness, can be set in 256 steps. Pins A0–A5 read voltages from 0 to 5 V with analogRead, giving a number from 0 to 1023 (about 4.9 mV per step). Pin 13 has a small built-in LED marked L.
How a sketch runs
Every Arduino sketch has two parts. setup() runs once when the board powers up: set the pin modes and start Serial there. loop() then runs again and again, forever, thousands of times a second unless you add a delay().
Buttons and INPUT_PULLUP
An input pin with nothing connected “floats” and reads random 0s and 1s. With pinMode(pin, INPUT_PULLUP), a resistor of about 20–50 kΩ inside the chip pulls the pin up to 5 V, so it reads HIGH. Wire the button between the pin and GND: pressing it connects the pin to 0 V, so it reads LOW. That is why the button mission checks for == LOW.
Measuring distance with sound
The HC-SR04 sends a burst of ultrasound when TRIG goes HIGH for 10 µs, then holds ECHO HIGH until the echo returns. Sound travels about 343 m/s, or 0.034 cm per microsecond, and has to go there and back, so distance (cm) = time (µs) × 0.034 ÷ 2, about time ÷ 58.
Questions students ask
Is this the same as a real Arduino?
Your code is the same C++ you would upload with the Arduino IDE, and the pins, timing and parts behave like the real ones. The simulator understands the common Arduino language (pinMode, digitalWrite, analogRead, delay, millis, Serial, Servo, tone, pulseIn, arrays and your own functions). Advanced C++ such as classes, pointers and most libraries is not supported.
How is this different from Tinkercad Circuits?
Tinkercad is great for building breadboard circuits. This simulator focuses on learning to code: step-by-step and slow-motion execution with the current line highlighted, a live variable watch, a pin timeline like a logic analyser, missions that test your code automatically, and plain-English error messages. It opens instantly on a phone with no account.
Why does my button read random values?
The pin is floating. Use pinMode(pin, INPUT_PULLUP) with the button wired to GND, then a press reads LOW and a release reads HIGH.
Why does analogWrite not dim my LED?
Only the PWM pins marked ~ (3, 5, 6, 9, 10 and 11 on an Uno) can dim. On other pins analogWrite just turns the pin fully on or off.
Can I use an ESP32?
Not yet. An ESP32 board with a Wi-Fi phone dashboard and an accelerometer earthquake-alarm mission is coming next.
More engineering and electricity
Connected tools
The same idea from another angle, across the site.