event loop updates
This commit is contained in:
parent
46e505a1fd
commit
a7318391c4
4
light_node/event_loop.py
Normal file → Executable file
4
light_node/event_loop.py
Normal file → Executable file
@ -1,3 +1,4 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
from flask import Flask, abort, jsonify, make_response, request
|
from flask import Flask, abort, jsonify, make_response, request
|
||||||
from colorsys import hsv_to_rgb
|
from colorsys import hsv_to_rgb
|
||||||
import board
|
import board
|
||||||
@ -8,7 +9,7 @@ import sys
|
|||||||
|
|
||||||
class Led:
|
class Led:
|
||||||
__IFACE_PIN = board.D18
|
__IFACE_PIN = board.D18
|
||||||
__PIXEL_COUNT = 36
|
__PIXEL_COUNT = 127
|
||||||
|
|
||||||
def __init__(self, power, brightness, color_angle):
|
def __init__(self, power, brightness, color_angle):
|
||||||
self.power = power
|
self.power = power
|
||||||
@ -16,6 +17,7 @@ class Led:
|
|||||||
self.color_angle = color_angle
|
self.color_angle = color_angle
|
||||||
self.iface_pin = self.__IFACE_PIN
|
self.iface_pin = self.__IFACE_PIN
|
||||||
self.strip = neopixel.NeoPixel(self.iface_pin, self.__PIXEL_COUNT)
|
self.strip = neopixel.NeoPixel(self.iface_pin, self.__PIXEL_COUNT)
|
||||||
|
self.strip[0] = (255, 0, 0)
|
||||||
|
|
||||||
def update(self, off=False):
|
def update(self, off=False):
|
||||||
rgb = self.angle_2_rgb()
|
rgb = self.angle_2_rgb()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user