relayer.signal("listening") phrase = listener.hear() relayer.signal("message decoded") return phrase def reply(phrase): relayer.command("move arms") response = get_response( phrase ) # picks one of several appropriate responses (video title) based on whether the given phrase contains a specific keyword responder.show( response) # plays the corresponding video given the video title ################################################################################## responder.default() #shows default eye image on screen while True: if pir.motion_detected(): responder.greet() phrase = listen() if not phrase: continue key = directive.command(phrase) obey(key) if key else reply(phrase)
from gpiozero import MotionSensor pir = MotionSensor(17) while True: i = pir.motion_detected() if i: print("Detected") else: print("nothing")