'''
example name：Button
version：v1.0
date：2020.3
Author：01Studio
Forum: forum.01studio.org
'''

from gpiozero import Button,LED #import related modules

#KEY1 is IO12,LED_R is IO4 (BCM coding)
KEY1 = Button(12)
LED_R  = LED(4)

while True:
    
    #Determine whether the KEY1 is pressed
    if KEY1.is_pressed:
        LED_R.on()
        print("KEY1 is pressed")
        
    else:
        LED_R.off()
        print("KEY1 is not pressed")