add a second strip to control

bluepill
JbLb 6 years ago
parent e9c112b6eb
commit 9ab9d364eb

@ -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();
}

Loading…
Cancel
Save