diff --git a/Adafruit_Video_Looper/video_looper.py b/Adafruit_Video_Looper/video_looper.py index f561ffa..7bffa7c 100644 --- a/Adafruit_Video_Looper/video_looper.py +++ b/Adafruit_Video_Looper/video_looper.py @@ -91,7 +91,8 @@ class VideoLooper: # Set GPIO Pin to input mode if self._gpio_control: - wiringpi.pinMode(self._gpio_control_pin, 0) + wiringpi.wiringPiSetup() + wiringpi.pinMode(int(self._gpio_control_pin), 0) def _print(self, message): @@ -244,8 +245,7 @@ class VideoLooper: self._prepare_to_run_playlist(playlist) # Main loop to play videos in the playlist and listen for file changes. while self._running: - if not self._gpio_control or wiringpi.digitalRead(self._gpio_control_pin) == self._gpio_control_upstate: - + if not self._gpio_control or wiringpi.digitalRead(int(self._gpio_control_pin)) == int(self._gpio_control_upstate): # Load and play a new movie if nothing is playing. if not self._player.is_playing(): movie = playlist.get_next() @@ -271,8 +271,8 @@ class VideoLooper: else: self._player.stop() - # Give the CPU some time to do other tasks. - time.sleep(0.002) + # Give the CPU some time to do other tasks. + time.sleep(0.1) def quit(self): """Shut down the program"""