mirror of
https://github.com/Febbweiss/mopidy-touchscreen.git
synced 2026-03-05 06:35:43 +00:00
GPIO
This commit is contained in:
@@ -10,17 +10,18 @@ class GPIOManager():
|
|||||||
def __init__(self):
|
def __init__(self):
|
||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)
|
GPIO.setup(24, GPIO.IN, pull_up_down = GPIO.PUD_UP)
|
||||||
GPIO.add_event_detect(24, GPIO.BOTH, callback=self.right(), bouncetime=30)
|
GPIO.add_event_detect(24, GPIO.BOTH, callback=right(), bouncetime=30)
|
||||||
|
|
||||||
def right(self, channel):
|
|
||||||
dict = {}
|
def right(channel):
|
||||||
if GPIO.input(channel) == 1:
|
dict = {}
|
||||||
dict['type'] = pygame.KEYUP
|
if GPIO.input(channel) == 1:
|
||||||
else:
|
dict['type'] = pygame.KEYUP
|
||||||
dict['type'] = pygame.KEYDOWN
|
else:
|
||||||
dict['key'] = pygame.K_RIGHT
|
dict['type'] = pygame.KEYDOWN
|
||||||
event = pygame.event.Event(dict)
|
dict['key'] = pygame.K_RIGHT
|
||||||
pygame.event.post(event)
|
event = pygame.event.Event(dict)
|
||||||
|
pygame.event.post(event)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user