Skip to content
Geo edited this page Jan 23, 2026 · 35 revisions

Digital I/O Mode

This mode allows full manual control of any GPIO pin on the ESP32.
Use it to read, write, sniff, or generate PWM signals on individual pins.
It’s useful for testing, probing and debugging.


🧩 Commands

Command Description
read <pin> Read the current digital state of a pin (returns 0 or 1)
set <pin> <H/L/I/O> Set the pin mode or level: H=HIGH, L=LOW, I=INPUT, O=OUTPUT
pullup <pin> Configure the pin as INPUT with internal pull-up resistor
pulldown <pin> Configure the pin as INPUT with internal pull-down resistor
pulse <pin> <us> Pulse given pin for us duration
sniff <pin> Monitor the pin and log level transitions until you press [ENTER]
pwm <pin> <freq> <duty> Generate a PWM signal on the pin (duty in %)
servo <pin> <angle> Move an RC servo connected to pin to the given angle (0–180°)
toggle <pin> <ms> Toggle the pin state every ms until ENTER is pressed
measure <pin> [ms] Count raising and falling edges to calculate frequency
jam <pin> [min_us] [max_us] Randomly switch pin state with random us delay
reset <pin> Reset the pin: detach PWM, set to INPUT with no pull-up

📝 Notes

  • All pin numbers must be valid GPIOs.
  • pwm uses ledcWrite() and supports 8-bit resolution (0–255).
  • servo uses 50 Hz PWM with 1–2 ms pulses.
  • sniff will log every rising/falling edge of the pin.
  • reset also detaches any PWM channel previously attached.
  • measure can take the duration in ms as a paramaters (max 5000ms).

📌 Example Usage

mode dio
read 21           # Print digital level on GPIO 21
set 21 O          # Set GPIO 21 as OUTPUT
set 21 H          # Set GPIO 21 to HIGH
set 21 high       # Set GPIO 21 to HIGH
set 21 low        # Set GPIO 21 to LOW
pullup 19         # Enable internal pull-up on GPIO 19
pulse 1 50        # Set pin 1 to HIGH for 50 us
sniff 22          # Monitor GPIO 22 transitions
pwm 5 1000 75     # Output PWM at 1kHz, 75% duty on GPIO 5
servo 1 90        # Move servo on pin 1 at 90 degres angle
toggle 1 100      # Toggle pin 1 every 100ms
measure 5         # Calculate falling/raising edges for 1sec
measure 5 2000    # Calculate edges for 2 sec
jam 1             # Randomly switch pin state with 5-100us random delay
reset 5           # Reset pin 5 to neutral state

▶️ Demo

dio

Clone this wiki locally