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; + } } //