from machine import Pin
import time
#Setup Pin
redLED = Pin(7, Pin.OUT)
yellowLED = Pin(8, Pin.OUT)
btnPush = Pin(16, Pin.IN, Pin.PULL_UP) #Befor press switch is logic 1
#Looping
while True:
if btnPush.value() == 0:
redLED.value(0)
yellowLED.value(1)
print("Value from push button: {0}".format(btnPush.value()))
else:
print("Value from push button: {0}".format(btnPush.value()))
redLED.value(1)
yellowLED.value(0)
time.sleep(0.25)