Arduino Code Simulator
Paste or write a sketch, add parts on chosen pins, press Run and watch LEDs blink, servos turn and the serial monitor print, all on simulated time. Press buttons, turn the potentiometer and send serial input while it runs.
Läuft in Ihrem Browser. Ihre Dateien verlassen nie Ihr Gerät. So prüfen Sie es
…
So geht's
- 1Load an example or write a sketch
setup() and loop().
- 2Add parts on pins
LEDs, buttons, sensors.
- 3Press Run
Choose a speed.
- 4Interact
Press buttons, turn knobs, send serial.
- 5Download the .ino
For a real board.
Über dieses Tool
Learning Arduino usually means buying a board, wiring a breadboard and installing the IDE before the first LED blinks. A simulator lets you start immediately and test ideas without hardware. This one runs sketches written in Arduino's C++ dialect directly in the browser: it converts them to JavaScript, runs them on simulated time so delay() works as on the real board, and connects virtual parts to the pins. It suits classrooms, quick experiments and checking logic before uploading to a real board.
Who this is for
Students and teachers learning microcontrollers, makers prototyping logic before wiring, and anyone who wants to understand a sketch they found online.
Writing sketches
Use setup() and loop() as usual. Supported: functions with parameters and return values, variables and constants of the usual types, arrays, #define, if, else, for, while, do and switch, and casts such as (int). Built-in functions include pinMode, digitalWrite, digitalRead, analogRead, analogWrite (PWM on pins 3, 5, 6, 9, 10, 11), delay, delayMicroseconds, millis, micros, map, constrain, random, min, max, abs and maths functions, bit helpers, tone and noTone, the Serial object (print, println, available, read, parseInt, readString) and the Servo library.
Adding parts
Add LEDs in any colour, RGB LEDs on three PWM pins, push buttons wired to ground (for INPUT_PULLUP) or to 5 V, potentiometers and light sensors on analog pins, a TMP36 temperature sensor, a piezo buzzer and a servo. Turn knobs and press buttons while the sketch runs; the board shows each pin's state and analog value.
Running
Press Run. The sketch runs in real time or at quarter, half, double or five times speed. The serial monitor shows output and sends text you type, as on the real board. Switch on sound to hear tone() through your speakers.
Examples
Blink, button and LED, fade with PWM, potentiometer to servo, traffic lights, temperature alarm with buzzer and serial echo.
Differences from a real board
The simulator focuses on the language and I/O most beginners use. Integer division follows JavaScript, so 7 / 2 gives 3.5 unless you cast with (int). Classes, structs, pointers, String methods and libraries other than Servo are not available. Timing is ideal, with no interrupt latency, and electrical limits such as pin current are not checked, so always add resistors on real hardware.
Common mistakes
- Forgetting pinMode(pin, OUTPUT) before writing to a pin. - Reading a button without INPUT_PULLUP or a pull-down resistor. - Using analogWrite on a pin without PWM (~).
Limits
Use the official Arduino IDE to compile and upload real programs. This simulator is a learning tool, not a replacement for testing on hardware, and not professional engineering advice.
Rechenbeispiel
The traffic lights example cycles red, red and amber, green and amber over 8 simulated seconds; at 5× speed the full cycle takes 1.6 seconds of real time.
Kurzinfos
- Kategorie: Entwickler & Daten
- Läuft in Ihrem Browser, ohne Anmeldung, ohne Upload.
- Ihre Eingaben bleiben auf Ihrem Gerät.
- Auf Englisch verfügbar.
- Inhalt zuletzt geprüft:
- Offizielle Quelle: Arduino Language Reference (Arduino.cc) for the supported functions
Häufig gestellte Fragen
Is my code uploaded?
No. The sketch is converted and run in your browser.
Does it support libraries?
Servo is built in; other libraries are not available.
Does delay() freeze the page?
No. The simulator runs on virtual time and the page stays responsive.
Can I use the serial monitor?
Yes, for output and for sending text to Serial.read and parseInt.
Which boards are simulated?
An Arduino Uno with pins D0-D13 and A0-A5.
Can I upload the sketch to a real Arduino?
Download the .ino and upload it with the Arduino IDE.
