Remix.run Logo
jdnenen 2 days ago

Emulating the CPU is nice, but the trouble has always been emulating the peripherals

Does your editor do this? I tried the example but didn't see e.g. LEDs blinking

dmcrespo 2 days ago | parent | next [-]

Yes,peripherals are fully emulated, not just the CPU. LEDs blink, buttons respond to clicks, Serial Monitor works, servos rotate, displays render (ILI9341 TFT), and we have 48 o more components from the wokwi-elements library. The Blink example should show the built-in LED toggling on pin 13. If it didn't blink for you, it might be a compilation issue

try the example Traffic Light : Simulate a traffic light with red, yellow, and green LEDs

functional_dev 2 days ago | parent [-]

does this handle the timing differences between browser execution and real time hardware? or is it focused on logic verification?

dmcrespo 2 days ago | parent [-]

Both, with a nuance. The AVR simulator syncs to wall-clock time and each frame calculates cycles from real elapsed deltaMs, so delay(1000) takes 1 real second and timer-dependent code (PWM, millis()) runs at correct real time rates. The RP2040 and ESP32-C3 simulators use a fixed cycles-per-frame budget (125MHz/60 and 160MHz/60 respectively), which targets real time but doesn't compensate for frame drops . if the browser stutters, emulated time stretches slightly. All three are cycle-accurate at the instruction level though, so the logic and peripheral behavior is faithful to real hardware regardless of frame timing

dmcrespo 2 days ago | parent | prev [-]

You can add peripherals There’s a “+” button on the right side of the circuit editor where you can add components like LEDs