diff options
-rw-r--r-- | .gitattributes | 1 | ||||
-rw-r--r-- | Software/led-test/led-test.ino | 64 |
2 files changed, 65 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3d999f7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.fcstd diff=freecad diff --git a/Software/led-test/led-test.ino b/Software/led-test/led-test.ino new file mode 100644 index 0000000..b0a10a2 --- /dev/null +++ b/Software/led-test/led-test.ino @@ -0,0 +1,64 @@ +#include <NeoPixelBus.h> + +#define pixelCount 20 +#define colorSaturation 255 + +using NPB = NeoPixelBus<NeoGrbFeature, NeoEsp8266BitBang400KbpsMethod>; + +NPB strip(pixelCount, D1); +RgbColor red(colorSaturation, 0, 0); +RgbColor green(0, colorSaturation, 0); +RgbColor blue(0, 0, colorSaturation); +RgbColor white(colorSaturation); +RgbColor black(0); + +RgbColor coral(255, 127, 80); +RgbColor tomato(255, 99, 71); +RgbColor orangered(255, 69, 0); +RgbColor gold(255, 215, 0); +RgbColor orange(255, 165, 0); +RgbColor darkorange(255, 140, 0); + +RgbColor colors[] = {red, green, blue, white, black, coral, tomato, orangered, gold, orange, darkorange}; + +template<typename T, int size> +constexpr int dim(T(&)[size]) { + return size; +} + +void setup() { + Serial.begin(115200); + delay(100); + + Serial.println(); + Serial.println(); + Serial.println(); + Serial.println(); + Serial.println("Hello world!"); + + strip.Begin(); + + analogWriteFreq(200); + + Serial.println("setup() done"); +} + +void loop() { + for (int i = 0; i < dim(colors); i++) { + auto c = colors[i]; + setColor(c); + + Serial.printf("r: %d, g: %d, b: %d\n", c.R, c.G, c.B); + Serial.println(); + delay(300); + } +} + +void setColor(RgbColor color) { + int i; + for (i = 0; i < strip.PixelCount(); i++) { + strip.SetPixelColor(i, color); + } + strip.Show(); +} + |