Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import RPi.GPIO as GPIO
- import time
- import os
- buttonShutdown = 6
- button9x9 = 13
- buttonNext = 19
- buttonPrev = 26
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(buttonShutdown, GPIO.IN)
- GPIO.setup(button9x9, GPIO.IN)
- GPIO.setup(buttonNext, GPIO.IN)
- GPIO.setup(buttonPrev, GPIO.IN)
- GPIO.add_event_detect(buttonShutdown, GPIO.FALLING)
- GPIO.add_event_detect(button9x9, GPIO.FALLING)
- GPIO.add_event_detect(buttonNext, GPIO.FALLING)
- GPIO.add_event_detect(buttonPrev, GPIO.FALLING)
- while True:
- if GPIO.event_detected(buttonShutdown):
- cmd = "echo shutdown"
- os.system(cmd)
- if GPIO.event_detected(button9x9):
- cmd = "echo 9x9"
- os.system(cmd)
- if GPIO.event_detected(buttonNext):
- cmd = "echo next"
- os.system(cmd)
- if GPIO.event_detected(buttonPrev):
- cmd = "echo prev"
- os.system(cmd)
- time.sleep(0.1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement