Skip to content

Instantly share code, notes, and snippets.

@sandyjmacdonald
Created January 4, 2015 20:25
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 sandyjmacdonald/cfbb1e81acb3b140880e to your computer and use it in GitHub Desktop.
Save sandyjmacdonald/cfbb1e81acb3b140880e to your computer and use it in GitHub Desktop.
Use the Pimoroni Unicorn HAT and Skywriter as a colour palette
#!/usr/bin/env python
import unicornhat as unicorn
import time, colorsys
import skywriter
import signal
unicorn.brightness(0.4)
unicorn.rotation(270)
@skywriter.move()
def palette(x, y, z):
h = x
s = y
v = 1 - z
for j in range(8):
for i in range(8):
rgb = colorsys.hsv_to_rgb(h, s, v)
r = int(rgb[0]*255.0)
g = int(rgb[1]*255.0)
b = int(rgb[2]*255.0)
unicorn.set_pixel(i, j, r, g, b)
unicorn.show()
time.sleep(0.0005)
signal.pause()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment