So far Pin 6 has 90 LED asigned to it and Pin 7 has 80 LED assigned to it.
Even with just a basic effect or a static colour, if I add any more than 80 per pin then pin 2 just doesn't work any more.
#include <WS2812FX.h>
#include <Arduino.h>
#define LED_COUNT_STRIP_1 80 //Number of LEDs in the strip, strip 1
#define LED_COUNT_STRIP_2 80 //Number of LEDs in the strip, strip 2
#define LED_PIN_STRIP_1 7 //Which pin are the LEDs connected to, strip 1
#define LED_PIN_STRIP_2 6 //Which pin are the LEDs connected to, strip 2
#define BUTTON_PIN PD4 //These are the buttons or inputs for changing effects
#define BUTTON_PIN1 PD5 // ""
bool button_pressed_0 = false; // Required for different input or buttons and must be added below and must be added after "if(digitalRead(BUTTON_PIN) == 1 &&"
bool button_pressed_1 = false; // ""
WS2812FX ws2812fx_strip1 = WS2812FX(LED_COUNT_STRIP_1, LED_PIN_STRIP_1, NEO_GRB + NEO_KHZ800);
WS2812FX ws2812fx_strip2 = WS2812FX(LED_COUNT_STRIP_2, LED_PIN_STRIP_2, NEO_GRB + NEO_KHZ800);
void setup() {
pinMode(BUTTON_PIN, INPUT); //Defines the button type can be INPUT for 5v or INPUT_PULLUP for connecting to ground
pinMode(BUTTON_PIN1, INPUT); // ""
//This will run when the arduino is powered on once
ws2812fx_strip1.init();
ws2812fx_strip2.init();
ws2812fx_strip1.setBrightness(100);
ws2812fx_strip2.setBrightness(100);
ws2812fx_strip1.setColor(WHITE);
ws2812fx_strip2.setColor(WHITE);
ws2812fx_strip1.setSpeed(1000);
ws2812fx_strip2.setSpeed(1000);
ws2812fx_strip1.setMode(FX_MODE_CHASE_WHITE);
ws2812fx_strip2.setMode(FX_MODE_CHASE_WHITE);
ws2812fx_strip1.start();
ws2812fx_strip2.start();
}
void processButton() { //Button processing down below, insert code in this area for button presses
//---------------------------------------------------------------------------------------------------
//----------This is when the button 0 IS pressed -----------
if(digitalRead(BUTTON_PIN) == 1 && button_pressed_0 == false) {
// parameters: index, start, stop, mode, color, speed, reverse
ws2812fx_strip1.setSegment(0, 0, 55, FX_MODE_COLOR_WIPE, ORANGE, 1000, false);
ws2812fx_strip1.resetSegmentRuntimes(); // This will make sure the segment always starts at the beginning
// parameters: index, start, stop, mode, color, speed, reverse
ws2812fx_strip1.setSegment(1, 89, 144, FX_MODE_COLOR_WIPE, ORANGE, 1000, false);
ws2812fx_strip1.resetSegmentRuntimes(); // This will make sure the segment always starts at the beginning
button_pressed_0 = true;
//----------This is when the button 0 IS NOT pressed -----------
} else if(digitalRead(BUTTON_PIN) == 0 && button_pressed_0 == true) {
// parameters: index, start, stop, mode, color, speed, reverse
ws2812fx_strip1.setSegment(0, 0, 55, FX_MODE_CHASE_WHITE, WHITE, 1000, false);
ws2812fx_strip1.resetSegmentRuntimes(); // This will make sure the segment always starts at the beginning
// parameters: index, start, stop, mode, color, speed, reverse
ws2812fx_strip1.setSegment(1, 89, 144, FX_MODE_CHASE_WHITE, WHITE, 1000, false);
ws2812fx_strip1.resetSegmentRuntimes(); // This will make sure the segment always starts at the beginning
button_pressed_0 = false;
}
//---------------------------------------------------------------------------------------------------
//----------This is when the button 1 IS pressed -----------
if(digitalRead(BUTTON_PIN1) == 1 && button_pressed_1 == false) {
// parameters: index, start, stop, mode, color, speed, reverse
ws2812fx_strip2.setSegment(0, 0, 55, FX_MODE_COLOR_WIPE, BLUE, 1000, true);
ws2812fx_strip2.resetSegmentRuntimes(); // This will make sure the segment always starts at the beginning
// parameters: index, start, stop, mode, color, speed, reverse
ws2812fx_strip2.setSegment(1, 89, 144, FX_MODE_COLOR_WIPE, BLUE, 1000, true);
ws2812fx_strip2.resetSegmentRuntimes(); // This will make sure the segment always starts at the beginning
button_pressed_1 = true;
//----------This is when the button 1 IS NOT pressed -----------
} else if(digitalRead(BUTTON_PIN1) == 0 && button_pressed_1 == true) {
// parameters: index, start, stop, mode, color, speed, reverse
ws2812fx_strip2.setSegment(0, 0, 55, FX_MODE_CHASE_WHITE, WHITE, 1000, true);
ws2812fx_strip2.resetSegmentRuntimes(); // This will make sure the segment always starts at the beginning
// parameters: index, start, stop, mode, color, speed, reverse
ws2812fx_strip2.setSegment(1, 89, 144, FX_MODE_CHASE_WHITE, WHITE, 1000, true);
ws2812fx_strip2.resetSegmentRuntimes(); // This will make sure the segment always starts at the beginning
button_pressed_1 = false;
}
//---------------------------------------------------------------------------------------------------
//Button Number please add
}
void loop() {
processButton();
ws2812fx_strip1.service();
ws2812fx_strip2.service();
}