This commit is contained in:
matteo porta 2022-06-29 11:58:24 +02:00
parent 351b990509
commit 8a7a0a65ff
3 changed files with 20 additions and 1 deletions

View File

@ -2,6 +2,7 @@ from .archive_synchronizer import ArchiveSynchronizer
from .consumer import Consumer
from .galaxy_camera import GalaxyCamera
from .modbus_component import ModbusComponent
from .neo_lights import NeoLights
from .os_label_printer import Os_Label_Printer
from .remote_api import RemoteAPI
from .serial_label_printer import Serial_Label_Printer

View File

@ -13,7 +13,7 @@ from .component import Component
C_UINT32_MAX = c_uint32(-1).value
class Serial_Label_Printer(Component):
class NeoLights(Component):
def __init__(self, config=None, name=None):
super().__init__(config=config, name=name, threaded=False)

18
src/test/neo_lights.py Normal file
View File

@ -0,0 +1,18 @@
from ctypes import c_uint32
import serial
C_UINT32_MAX = c_uint32(-1).value
conn = serial.Serial(
"/dev/ttyACM1",
baudrate=9600,
stopbits=serial.STOPBITS_ONE,
parity=serial.PARITY_NONE,
bytesize=serial.EIGHTBITS,
)
pixel = C_UINT32_MAX
color = "#ff00ff"
conn.write(int.to_bytes(pixel, length=4, byteorder="big") + bytes.fromhex(color[1:7]) + b"\n")
response = conn.readline()
print(response)
conn.close()