'''
example name：Human Body induction Sensor
version：v1.0
date：2020.3
Author：01Studio
Forum: forum.01studio.org
'''

from gpiozero import MotionSensor, LED
from signal import pause

#creat objects
People = MotionSensor(18)
LED_R = LED(4)

def fun1():
    LED_R.on()
    print('Got People!!!')
    
def fun2():
    LED_R.off()
    print('No People!!!')

#people move and no people
People.when_motion = fun1
People.when_no_motion = fun2

#Block IO, let the program keep running
while True:
    pass