use board
This commit is contained in:
parent
a54d6d4b98
commit
18678e0b60
1 changed files with 3 additions and 2 deletions
5
leds.py
5
leds.py
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
import neopixel
|
import neopixel
|
||||||
|
import board
|
||||||
|
|
||||||
|
|
||||||
class Adafruit_CharLCD:
|
class Adafruit_CharLCD:
|
||||||
|
@ -247,7 +248,7 @@ def defaultPattern(n, t):
|
||||||
return ((n + t) % 255, (n + t) % 255, (n + t) % 255)
|
return ((n + t) % 255, (n + t) % 255, (n + t) % 255)
|
||||||
|
|
||||||
class LightStrip:
|
class LightStrip:
|
||||||
def __init__(self, data_pin = 18, string_length = 300, brightness = 1, pixel_order = neopixel.GRB, GPIO=None):
|
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
|
# Emulate the old behavior of using RPi.GPIO if we haven't been given
|
||||||
# an explicit GPIO interface to use
|
# an explicit GPIO interface to use
|
||||||
if not GPIO:
|
if not GPIO:
|
||||||
|
@ -258,7 +259,7 @@ class LightStrip:
|
||||||
|
|
||||||
self.GPIO.setup(self.data_pin, GPIO.OUT)
|
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.np = neopixel.NeoPixel(self.data_pin, string_length, brightness = brightness, auto_write=True, pixel_order = pixel_order)
|
||||||
self.pattern = defaultPattern
|
self.pattern = defaultPattern
|
||||||
self.cur_tick = 0
|
self.cur_tick = 0
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue