ESP32 For-Loop Explorer

Dynamic execution visualizer, MCU register tracer, and hardware GPIO simulator.

GPIO Simulation

3.3V LOGIC
ESP32
WROOM
ESP32-NodeMCU
Tensilica Xtensa Dual-Core
READY
Addressable LED Array IDLE
digitalWrite():
Pin: -- State: LOW
firmware_loop.cpp
CYCLE PHASE: READY
// Pin definitions for digital outputs
const int ledPins[] = {16, 17, 18, 19, 21, 22, 23, 25};

void loop() {
    for ( int i = 0; i < 5; i++ ) {

        int pin = ledPins[i];
        digitalWrite(pin, HIGH);
        Serial.printf("Pin %d ON (i = %d)\n", pin, i);
        delay(500);    }
    
    // Cycle completed. Awaiting restart...
}

Internal Processor Registers & Condition Evaluator 32-bit Xtensa ISA

Loop Index (i) RAM: 0x3FFB0014
0 0b00000000
Data Type: int (signed 32b)
Condition Check i < limit
0 < 5 TRUE
Branch Jump: Continue Loop
Serial Monitor 115200 baud
// Serial ready. Waiting to run...
For-Loop Lifecycle Explained
1

Initialization

Executed once at loop entry. Allocates variable and assigns initial value.

2

Condition Test

Evaluated before every iteration. If true, body runs; if false, loop breaks.

3

Loop Body

The statements inside { } run: GPIO pins toggle, math computes, serial writes happen.

4

Increment

Counter updates (i++). Microcontroller jumps immediately back to step 2.

Loop Presets

Auto Delay 600 ms
Upper Limit (< N) 5
Step Size (i += S) 1
Simulation Activity:

Ready to run. Click Auto Play or Step Forward.

ESP32 Loop Visualizer
Educational Embedded Lab V2.0