This commit is contained in:
janeptrv 2020-11-06 20:36:45 -05:00
parent 18678e0b60
commit 326407887b
1 changed files with 1 additions and 10 deletions

11
leds.py
View File

@ -248,16 +248,7 @@ 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, 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)
def __init__(self, data_pin = board.D18, string_length = 300, brightness = 1, pixel_order = neopixel.GRB):
self.np = neopixel.NeoPixel(self.data_pin, string_length, brightness = brightness, auto_write=True, pixel_order = pixel_order)
self.pattern = defaultPattern