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

from gpiozero import Button,LED

KEY1 = Button(12)
LED_R=LED(4)

def fun():
    
    LED_R.toggle() #Red LED status flip

#Set key interrupt
KEY1.when_pressed = fun

#Block the thread and let the program continue to execute
while True:
    pass