from machine import Pin # import Pin class
import time # import time module
# create pin object from Pin22, set Pin22 to input
pinIn = Pin(12, Pin.IN, Pin.PULL_UP)
# create pin object from Pin25, set Pin25 to output
pinLED = Pin(25, Pin.OUT)
pin = Pin(28, Pin.OUT)
while True: # create an infinite loop
while pinIn.value() == 0: # if pinIn is released
pass # do nothing
print("0") # print 0
while pinIn.value() == 1: # if pinIn is pressed
pass # do nothing
print("1") # print 1
pinLED.on() # set pinLED turn on
pin.on()
time.sleep(1) # sleep 1 second
pinLED.off() # set pinLED turn off
pin.off()