← Back to Lab Hub RP2040 MicroPython Digital I/O Lab

RP2040 Internal Pull-Up vs. Pull-Down Physics Simulator

Visualizing Default Idle Voltages, Active Switch Closures, and Active-LOW / Active-HIGH Logic

⚡ Internal Resistor Voltage Reference Physics
Pull-Down Resistor (Default = 0.0V LOW / `0`): Connects the input pin to Ground via an internal ~50kΩ resistor. When the switch is open, the pin stays tied to 0V. Closing the switch connects direct 3.3V, pulling the pin HIGH (`1`).
Pull-Up Resistor (Default = 3.3V HIGH / `1`): Connects the input pin to 3.3V VCC via ~50kΩ. When the switch is open, the pin reads 3.3V (`1`). Closing the switch shorts the pin to Ground, pulling it LOW (`0`) (Active-LOW logic).

Pin.PULL_DOWN: Idle = 0V (LOW) | Pressed = 3.3V (HIGH) Pin.PULL_UP: Idle = 3.3V (HIGH) | Pressed = 0V (LOW)
1. Select Internal Resistor Configuration:
2. Actuate Physical Switch:
🐍 MicroPython Live Code State
from machine import Pin
import time

# Configure Input Pin with Internal Resistor
btn = Pin(14, Pin.IN, Pin.PULL_DOWN)

# Read Pin Register State
while True:
  val = btn.value() # Live Read: 0 (0.0V LOW)
  time.sleep_ms(20)
📝 Concept Check Quiz
When configuring an input pin as `Pin.PULL_UP`, why does pressing a switch connected to Ground cause `btn.value()` to return `0`?