Advertisement
belrey10

Day 2: Crossing the Threshold – Using a Button to Control the LED

Nov 4th, 2024 (edited)
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.17 KB | None | 0 0
  1. from machine import Pin
  2.  
  3. led = Pin(15, Pin.OUT)
  4. button = Pin(16, Pin.IN, Pin.PULL_DOWN)
  5.  
  6. while True:
  7.   if button.value() == 1:
  8.     led.on()
  9.   else: led.off()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement