from machine import Pin
import time
# Daftar GPIO untuk LED dan push button
led_pins = [2, 3, 4] # Output LED
button_pins = [9, 10, 11, 12, 13, 14] # Input dari push button
# Inisialisasi LED sebagai output
leds = [Pin(pin, Pin.OUT) for pin in led_pins]
# Inisialisasi push button sebagai input dengan pull-down
buttons = [Pin(pin, Pin.IN, Pin.PULL_DOWN) for pin in button_pins]
while True:
# Setiap 2 input masing-masing menghidupkan 1 output LED
for i in range(3):
if buttons[i * 2].value() == 1 or buttons[i * 2 + 1].value() == 1: # Jika salah satu push button ditekan
leds[i].on() # Nyalakan LED
else:
leds[i].off() # Matikan LED
time.sleep(0.05) # Delay untuk debounce sederhana
pico:GP0
pico:GP1
pico:GND.1
pico:GP2
pico:GP3
pico:GP4
pico:GP5
pico:GND.2
pico:GP6
pico:GP7
pico:GP8
pico:GP9
pico:GND.3
pico:GP10
pico:GP11
pico:GP12
pico:GP13
pico:GND.4
pico:GP14
pico:GP15
pico:GP16
pico:GP17
pico:GND.5
pico:GP18
pico:GP19
pico:GP20
pico:GP21
pico:GND.6
pico:GP22
pico:RUN
pico:GP26
pico:GP27
pico:GND.7
pico:GP28
pico:ADC_VREF
pico:3V3
pico:3V3_EN
pico:GND.8
pico:VSYS
pico:VBUS
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r
btn4:1.l
btn4:2.l
btn4:1.r
btn4:2.r
btn5:1.l
btn5:2.l
btn5:1.r
btn5:2.r
btn6:1.l
btn6:2.l
btn6:1.r
btn6:2.r
btn7:1.l
btn7:2.l
btn7:1.r
btn7:2.r
r1:1
r1:2
r2:1
r2:2
r3:1
r3:2
led2:A
led2:C
led3:A
led3:C
led1:A
led1:C