Created
January 4, 2015 20:25
-
-
Save sandyjmacdonald/cfbb1e81acb3b140880e to your computer and use it in GitHub Desktop.
Use the Pimoroni Unicorn HAT and Skywriter as a colour palette
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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