From a45c8104d8a9c2ef999e1822a7b56cc8f768320a Mon Sep 17 00:00:00 2001 From: Matt Date: Thu, 12 May 2016 22:34:38 -0400 Subject: [PATCH] Update test and firmware files to update Pixie every sec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Send a signal to change the color of the light every second to prevent them from getting “stuck” re: https://learn.adafruit.com/pixie-3-watt-smart-chainable-led-pixels/ “You do have to send it data every 1 second at a minimum (as a protection against the bright and hot LEDs staying 'stuck on', they will eventually timeout if no updates are received)” --- ino/mcopy_light/mcopy_light.ino | 10 ++++++++++ ino/mcopy_light_tests/mcopy_light_tests.ino | 9 +++++++++ 2 files changed, 19 insertions(+) diff --git a/ino/mcopy_light/mcopy_light.ino b/ino/mcopy_light/mcopy_light.ino index 7eb1565..7679ec1 100644 --- a/ino/mcopy_light/mcopy_light.ino +++ b/ino/mcopy_light/mcopy_light.ino @@ -20,6 +20,9 @@ volatile int r = 0; volatile int g = 0; volatile int b = 0; +unsigned long now; //to be compared to stored values every loop +unsigned long light_time; + const char cmd_light = 'l'; const char cmd_debug = 'd'; @@ -44,6 +47,13 @@ void loop () { cmd(cmd_char); cmd_char = 'z'; } + now = millis(); + //send light signal to pixie every second + if (now - light_time >= 1000) { + light.setPixelColor(0, r, g, b); + light.show(); + light_time = now; + } } // diff --git a/ino/mcopy_light_tests/mcopy_light_tests.ino b/ino/mcopy_light_tests/mcopy_light_tests.ino index 97818f7..d6038a0 100644 --- a/ino/mcopy_light_tests/mcopy_light_tests.ino +++ b/ino/mcopy_light_tests/mcopy_light_tests.ino @@ -28,6 +28,9 @@ volatile int r = 0; volatile int g = 0; volatile int b = 0; +unsigned long now; //to be compared to stored values every loop +unsigned long light_time; + const char cmd_light = 'l'; const char cmd_debug = 'd'; @@ -54,6 +57,12 @@ void loop () { cmd(cmd_char); cmd_char = 'z'; } + now = millis(); + if (now - light_time >= 1000) { + light.setPixelColor(0, r, g, b); + light.show(); + light_time = now; + } } //