from machine import Pin
import time
pushPin = Pin(16, Pin.IN)
redLED = Pin(14, Pin.OUT)
greenLED = Pin(15, Pin.OUT)
while True:
btnstus = pushPin.value()
if btnstus == 0:
print("Value from push button: ",btnstus)
print("Red on / Green off.")
redLED.value(1)
greenLED.value(0)
else:
print("Value from push button: ",btnstus)
print("Red off / Green on.")
redLED.value(0)
greenLED.value(1)
time.sleep(1)