Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ukBaz/4fa1ebdaf81ea5bcc7e01bafe03610ab to your computer and use it in GitHub Desktop.
Save ukBaz/4fa1ebdaf81ea5bcc7e01bafe03610ab to your computer and use it in GitHub Desktop.
HSV color control of the Blinkt! from a Blue Dot.
#!/usr/bin/env python
from bluedot import BlueDot
import colorsys
import time
import blinkt
def move(pos):
# print("The Blue Dot x={} y={} d={} a={}".format(pos.x, pos.y, pos.distance, pos.angle))
h=((pos.angle+180) % 360) / 360
s=pos.distance
v=1.0
r, g, b = [int(c*255) for c in colorsys.hsv_to_rgb(h, s, v)]
for x in range(blinkt.NUM_PIXELS):
blinkt.set_pixel(x, r, g, b)
blinkt.show()
blinkt.set_brightness(0.1)
blinkt.set_clear_on_exit()
bd = BlueDot()
bd.wait_for_press()
bd.when_pressed = move
bd.when_moved = move
while True:
time.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment