def handleLedMessage(message):
if message.type == 'note_on' or message.type == 'note_off':
h = message.note / 127.0
s = message.velocity / 127.0
if message.type == 'note_on':
v = 1.0
else:
v = 0.0
rgb = colorsys.hsv_to_rgb(h, s, v)
r = int(rgb[0] * 255)
g = int(rgb[1] * 255)
b = int(rgb[2] * 255)
print("LED ring r:{} g:{} b:{}".format(r, g, b))
publishLedColor(r, g, b)
评论列表
文章目录