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
import matplotlib.pyplot as plt | |
import numpy as np | |
# matlab style errorbars | |
def errorbars(x, y, err, erralpha=0.2, color=None, label=None, ax=plt): | |
line = ax.plot(x, y, color=color, label=label) | |
col = line[0].get_color() | |
plt.fill_between(x, y-err, y+err, alpha=erralpha, color=col, zorder=-1) | |
# example |
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
//x is in range [0, 1024] | |
byte hueCurve(int x) { | |
x += 1024/3; | |
x = x % 1024; | |
return max(255-abs(255-x*(255.0*3/1024)), 0); | |
} | |
void setHue(int led_id, int hue) { | |
byte r = hueCurve(hue); | |
byte g = hueCurve(hue+(1024*2)/3); |