From 982f11aac6242a6617265509c148832c79263ae5 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sun, 23 Oct 2016 13:05:39 +0200 Subject: o Adding software. --- .gitattributes | 1 + Software/led-test/led-test.ino | 64 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 .gitattributes create mode 100644 Software/led-test/led-test.ino 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 + +#define pixelCount 20 +#define colorSaturation 255 + +using NPB = NeoPixelBus; + +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 +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(); +} + -- cgit v1.2.3