Created
August 18, 2016 14:12
-
-
Save atbradley/e93b12ae0f1159a3fb4e315bac560e70 to your computer and use it in GitHub Desktop.
The product of some experimentation with a Blinkstick Nano (https://www.blinkstick.com/).
This file contains hidden or 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
from blinkstick import blinkstick | |
from matplotlib import cm, colors | |
from time import sleep | |
cmap = cm.get_cmap('coolwarm') | |
def getColor(n): | |
colr = cmap(n)[0:3] | |
outp = [x * .15 for x in colr] | |
adj = [x * .25 if x == max(colr) else x*.15 for x in colr] | |
return colors.rgb2hex(colr), colors.rgb2hex(outp), colors.rgb2hex(adj) | |
bstick = blinkstick.find_all()[0] | |
for x in range(0, 11): | |
bright, dark, adj = getColor(x/10) | |
bstick.set_color(hex=adj) | |
sleep(1) | |
bstick.turn_off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment