forked from j3d1/fiatlux
27 lines
494 B
Python
27 lines
494 B
Python
#!/usr/bin/env python3
|
|
import serial
|
|
import time
|
|
ser = serial.Serial("/dev/ttyUSB0", 115200)
|
|
|
|
def setCh(ch, ana, pwm):
|
|
ser.write(bytearray([ch*4+1, ana >> 8, ch*4+2, ana & 0xff, ch*4+4, pwm, 0,0]))
|
|
|
|
def setG(val):
|
|
ser.write(bytearray([128,val,0]))
|
|
|
|
setCh(0,0,0)
|
|
setCh(1,0,0)
|
|
setCh(2,0,0)
|
|
setCh(3,0,0)
|
|
setCh(4,0,0)
|
|
setCh(5,0,0)
|
|
|
|
if False: #for i in range(0, 4095, 5):
|
|
print(i)
|
|
setCh(0,i,255)
|
|
time.sleep(0.1)
|
|
|
|
for i in range(255):
|
|
print(i)
|
|
setG(i)
|
|
time.sleep(0.5)
|