From 93e01d17ae38db1c85a33d366d2e2f8bdea8a092 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Tue, 23 Jul 2013 03:17:30 +0200 Subject: [PATCH] working well with DOWN method --- piplayer.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/piplayer.py b/piplayer.py index 6687fe6..b55db7a 100644 --- a/piplayer.py +++ b/piplayer.py @@ -55,18 +55,18 @@ class GPIOController(Thread): def __init__(self, channel): Thread.__init__(self) - self.gpio_channel = channel - - def add_callback(self, callback): import RPi.GPIO as GPIO + self.server = GPIO + self.gpio_channel = channel GPIO.setmode(GPIO.BCM) - GPIO.setup(self.gpio_channel, GPIO.IN, pull_up_down=GPIO.PUD_UP) - GPIO.add_event_detect(self.gpio_channel, GPIO.PUD_UP, callback=callback) + GPIO.setup(self.gpio_channel, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) + + def add_callback(self, callback): + GPIO.add_event_detect(self.gpio_channel, GPIO.PUD_DOWN, callback=callback, bouncetime=100) def run(self): - while True: - time.sleep(0.1) - + pass + class AudioPlayer(object): -- 2.39.5