From 9ab9d364ebbad55c793b5d845b8a927d1fe1ebb4 Mon Sep 17 00:00:00 2001 From: JbLb Date: Sun, 9 Feb 2020 13:49:40 +0100 Subject: [PATCH] add a second strip to control --- hoverserial.ino | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/hoverserial.ino b/hoverserial.ino index 0ed0d01..ca809c6 100644 --- a/hoverserial.ino +++ b/hoverserial.ino @@ -6,7 +6,7 @@ #include "leds_config.h" // Declare our NeoPixel strip object: -Adafruit_NeoPixel strip(LED_STRIP * NB_STRIP , PIN, NEO_GRB + NEO_KHZ800); +Adafruit_NeoPixel strip(LED_STRIP *NB_STRIP, PIN, NEO_GRB + NEO_KHZ800); // Argument 1 = Number of pixels in NeoPixel strip // Argument 2 = Arduino pin number (most are valid) // Argument 3 = Pixel type flags, add together as needed: @@ -289,34 +289,35 @@ void loop() digitalWrite(LED_BUILTIN, (timeNow % 2000) < 1000); Receive(); Nunchuk_control(); - + strip.clear(); + strip.setPixelColor(idx_led, strip.Color(128, 0, 0)); + strip.setPixelColor((NB_STRIP * LED_STRIP) - 1 - idx_led, strip.Color(128, 0, 0)); // second LEDs strip + strip.show(); if (iTimeSend > timeNow) return; if (cmd2 == 0) return; - iTimeSend = timeNow + ((200 - abs(cmd2)) * 2); // TIME_SEND - strip.clear(); - strip.setPixelColor(idx_led, strip.Color(128, 0, 0)); - if (cmd2 > 0){ - if (idx_led < strip.numPixels() -1 ) - { - idx_led++; - } - else - { - idx_led = 0; - } + iTimeSend = timeNow + ((200 - abs(cmd2)) * 2); // TIME_SEND + if (cmd2 > 0) + { + if (idx_led < LED_STRIP - 1) + { + idx_led++; + } + else + { + idx_led = 0; + } } else { - if (idx_led > 0 ) - { - idx_led--; - } - else - { - idx_led = strip.numPixels() -1 ; - } + if (idx_led > 0) + { + idx_led--; + } + else + { + idx_led = LED_STRIP - 1; + } } - strip.show(); }