Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pynput import mouse
- import time
- import rpi_backlight as bl
- bl.set_power(False) # Turn Off the Screen Initially
- def on_move(x, y):
- control_screen()
- def on_click(x, y, button, pressed):
- control_screen()
- def control_screen():
- if (bl.get_power() == False): # If the Screen is OFF
- bl.set_power(True) # Turn On Screen
- bl.set_brightness(200, smooth=True, duration=3)
- time.sleep(30) # Wait 30 Seconds
- bl.set_power(False) # Turn Screen Off Again
- # Collect events until released
- with mouse.Listener(
- on_move=on_move,
- on_click=on_click) as listener:
- listener.join()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement