-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
37 lines (29 loc) · 1.25 KB
/
server.py
File metadata and controls
37 lines (29 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from neopixel import *
# LED strip configuration:
LED_COUNT = 600 # Number of LED pixels.
LED_PIN = 18 # GPIO pin connected to the pixels (18 uses PWM!).
# LED_PIN = 10 # GPIO pin connected to the pixels (10 uses SPI /dev/spidev0.0).
LED_FREQ_HZ = 800000 # LED signal frequency in hertz (usually 800khz)
LED_DMA = 10 # DMA channel to use for generating signal (try 10)
LED_BRIGHTNESS = 128 # Set to 0 for darkest and 255 for brightest
LED_INVERT = False # True to invert the signal (when using NPN transistor level shift)
LED_CHANNEL = 0 # set to '1' for GPIOs 13, 19, 41, 45 or 53
class Server:
LED_COUNT = LED_COUNT
def __init__(self):
self.strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT, LED_BRIGHTNESS, LED_CHANNEL)
self.strip.begin()
super().__init__()
def toggleOffLights(self):
pass
def setPixelRGB(self, loc, r, g, b):
self.strip.setPixelColorRGB(loc, r, g, b)
def setPixelColor(self, loc, Color):
self.strip.setPixelColor(loc, Color)
def show(self):
self.strip.show()
def getBrightness(self):
return self.strip.getBrightness();
def setBrightness(self,val):
self.strip.setBrightness(val)
self.show()