I'm a noob at programming in python. How do I make a script that awakes the monitor and put it to sleep on a condition?
import RPi.GPIO as GPIO
PIR = 23
GPIO.setmode(GPIO.BCM)
GPIO.setup(PIR, GPIO.IN)
while True:
if GPIO.input(PIR):
""" There should be the "awake monitor" function """"
else:
"""" There should be something that makes my script run over and over but after for example 2 minutes after there is no signal on PIR.
As you can see, I have a motion sensor, which I want to make my monitor awake from sleep every time it senses a motion, but after there is no motion in its area any more, after two minutes it should put monitor to sleep.
Can you please help me?