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

Direct 3.3V Digital Input & Output LED Simulator

RP2040 Pin-Number Level Visualization & Direct Input-to-Output Signal Mapping

⚡ RP2040 Direct Pin Assignment & 3.3V Digital Signals
Logic HIGH vs Logic LOW: The RP2040 microcontroller reads 3.3V as a digital 1 (HIGH) and 0.0V as a digital 0 (LOW). When a direct 3.3V signal is assigned to an input pin (e.g., GP14, GP16, GP18), MicroPython reads the state and sets the corresponding output pin (e.g., GP15, GP17, GP19) HIGH to light up the LED circuit.

Mapped Channel Matrix: Channel 1: GP14 (3.3V In) → GP15 (Red LED) Channel 2: GP16 (3.3V In) → GP17 (Green LED) Channel 3: GP18 (3.3V In) → GP19 (Blue LED)
🔴 Channel 1: Pin GP14 (In) → Pin GP15 (Red LED)
🟢 Channel 2: Pin GP16 (In) → Pin GP17 (Green LED)
🔵 Channel 3: Pin GP18 (In) → Pin GP19 (Blue LED)
🐍 MicroPython Code: Live Pin State Inspector
from machine import Pin
import time

# Explicit RP2040 GPIO Pin Assignments
pin_gp14 = Pin(14, Pin.IN) # Input Channel 1
pin_gp15 = Pin(15, Pin.OUT) # Red LED Output
pin_gp16 = Pin(16, Pin.IN) # Input Channel 2
pin_gp17 = Pin(17, Pin.OUT) # Green LED Output
pin_gp18 = Pin(18, Pin.IN) # Input Channel 3
pin_gp19 = Pin(19, Pin.OUT) # Blue LED Output

# Direct Polling & Pin State Loop
while True:
  pin_gp15.value(pin_gp14.value()) # GP14->GP15: 0 (0.0V)
  pin_gp17.value(pin_gp16.value()) # GP16->GP17: 0 (0.0V)
  pin_gp19.value(pin_gp18.value()) # GP18->GP19: 0 (0.0V)
  time.sleep_ms(20)
📝 Concept Check Quiz
Why is it necessary to specify exact GPIO pin numbers (like Pin(14) and Pin(15)) in MicroPython code?