09 DIO - geo-tp/ESP32-Bus-Pirate GitHub Wiki

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
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 %)
toggle <pin> <ms> Toggle the pin state every ms until ENTER is pressed
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).
  • sniff will log every rising/falling edge of the pin.
  • reset also detaches any PWM channel previously attached.

📌 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
sniff 22          # Monitor GPIO 22 transitions
pwm 5 1000 75     # Output PWM at 1kHz, 75% duty on GPIO 5
toggle 1 100      # Toggle pin 1 every 100ms
reset 5           # Reset pin 5 to neutral state

▶️ Demo

demo7

⚠️ **GitHub.com Fallback** ⚠️