from machine import Pin
from utime import sleep
button = Pin(14, mode = Pin.IN, pull = Pin.PULL_UP)
led = Pin(16, Pin.OUT)
print("Hello, Pi Pico!")
print("This is Experiment - 4 and Objective - 4")
print("Name: Chinmaya Priyadarshan Sethi; Registration No.: 1941012849")
print("Objective : 4 Controlling an LED with button using internal Pull-up and Pull-Down resistors.")
while True:
if button.value()==0:
led. value(1)
print("LED is ON")
sleep(0.3)
elif button.value() ==1:
led.value(0)
sleep(0.3)