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.

S'exécute dans votre navigateur. Vos fichiers ne quittent jamais votre appareil. Voir comment vérifier

…

Comment faire

  1. 1
    Load an example or write a sketch

    setup() and loop().

  2. 2
    Add parts on pins

    LEDs, buttons, sensors.

  3. 3
    Press Run

    Choose a speed.

  4. 4
    Interact

    Press buttons, turn knobs, send serial.

  5. 5
    Download the .ino

    For a real board.

À propos de cet outil

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.

Exemple concret

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.

L'essentiel

Questions fréquentes

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.

Entièrement gratuitAucun coût, aucune inscription
Fichiers privésTout s'exécute dans votre navigateur
Simple dans votre langueDisponible en de nombreuses langues