summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-10-23 13:05:39 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-10-23 13:05:49 +0200
commit982f11aac6242a6617265509c148832c79263ae5 (patch)
treecb9a50f9dc81b8287e07437433c8aff949133bec
parent494e64a02433442bbdcfac371a6aad76abc80366 (diff)
downloadplant-incubator-stand-982f11aac6242a6617265509c148832c79263ae5.tar.gz
plant-incubator-stand-982f11aac6242a6617265509c148832c79263ae5.tar.bz2
plant-incubator-stand-982f11aac6242a6617265509c148832c79263ae5.tar.xz
plant-incubator-stand-982f11aac6242a6617265509c148832c79263ae5.zip
o Adding software.HEADmaster
-rw-r--r--.gitattributes1
-rw-r--r--Software/led-test/led-test.ino64
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();
+}
+