From 26aee5c79004e00adb010716c9fc990bfaf359fb Mon Sep 17 00:00:00 2001 From: janeptrv Date: Fri, 6 Nov 2020 20:32:02 -0500 Subject: [PATCH] t --- leds.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/leds.py b/leds.py index 2d034a5..181c7bc 100644 --- a/leds.py +++ b/leds.py @@ -7,7 +7,6 @@ # from time import sleep -import board import neopixel @@ -248,9 +247,16 @@ def defaultPattern(n, t): return ((n + t) % 255, (n + t) % 255, (n + t) % 255) class LightStrip: - def __init__(self, data_pin = board.D18, string_length = 300, brightness = 1, pixel_order = neopixel.GRB): + def __init__(self, data_pin = 18, string_length = 300, brightness = 1, pixel_order = neopixel.GRB, GPIO=None): # Emulate the old behavior of using RPi.GPIO if we haven't been given # an explicit GPIO interface to use + if not GPIO: + import RPI.GPIO as GPIO + self.GPIO = GPIO + self.GPIO.setmode(GPIO.BCM) + self.data_pin = data_pin + + self.GPIO.setup(self.data_pin, GPIO.OUT) self.np = neopixel.NeoPixel(data_pin, string_length, brightness = brightness, auto_write=True, pixel_order = pixel_order) self.pattern = defaultPattern