提高LED灯响应速度

This commit is contained in:
NuoDaJia02
2025-10-27 11:42:19 +08:00
parent 4c94eb2805
commit 071aec3b6c

View File

@@ -66,6 +66,25 @@ class LedCommand(Node):
start_id=256
end_id=0
val=0
if xnum==0:
val=255
if rgb_data=='red':
rgb = [val, 0, 0,0] * num_ic
elif rgb_data=='green':
rgb = [0, val, 0,0] * num_ic
elif rgb_data=='blue':
rgb = [0, 0, val,0] * num_ic
elif rgb_data=='cyan':#青色
rgb = [0, val, val,0] * num_ic
elif rgb_data=='yellow':#黄色
rgb = [val, val, 0,0] * num_ic
elif rgb_data=='purple':#紫色
rgb = [val, 0, val,0] * num_ic
elif rgb_data=='white':#紫色
rgb = [val, val, val,0] * num_ic
print(rgb)
self.driver.send_frame(rgb)
return
for i in range(start_id,end_id,xnum):
#offset=i*5
val=i##offset