While simulating an Arduino isn’t a new idea, a recent project by [LRusso] provides an open source JavaScript simulator that runs in your browser. You can try it out live or host it yourself if you prefer.
The simulator looks much like the standard IDE, so there isn’t much to learn. You can select from several targets, including a UNO R3, a MEGA 1280, a MEGA 2560, or a NANO V3. At the bottom of the screen, you’ll see the correct number of digital pins, analog pins, and the serial monitor. The code is relatively new, and we noticed that the digital and output pins seem to work only for outputs. There is no way to modify any of the values from the user interface. You can, however, enter things into the serial monitor.
You can run a canned demo that uses digital and analog output. There is also another sample that uses the serial port. Unlike some other simulators, you can’t really add much external circuitry but, for some purposes, that isn’t a problem.
If you are looking for more, there is Simulide, which is also free. Falstad can do mixed signal simulations with Arduino code. There’s also Wokwi, which we’ve covered a few times before.
Source: ARDUINO, VIRTUALLY