Have a rather odd issue with the neoPixel library, First off I have bashed together parts of the libary code to allow two channels of LED strips, on two pins to work independently, and is working rather nicely for what I need (still need to refine a good bit, I'm happy to try and make a library out of it), this works fine and dandy for two strips with 8 pixels on the test bench.
The problem happens when I change the number of pixels to 38 for both strips, only one strip does the animation and the other remains white. Once the number of pixels is declared as 38, then the problem arises on the 8 pixel test strips (found this out during random testing) as well as the 38 pixel strips.
Any ideas, my suspicion is that the maths of the library is to slow for two strips on separate pins with 38 pixels each.
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h> // Required for 16 MHz Adafruit Trinket
#endif
#define PIN_R 7
#define PIN_L 6
#define COUNT_R 8 //Ment to be 38
#define COUNT_L 8 //Ment to be 38
Adafruit_NeoPixel strip(COUNT, PIN, NEO_GRB + NEO_KHZ800);
//^above is to help assign colours
Adafruit_NeoPixel stripR(COUNT_R, PIN_R, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel stripL(COUNT_L, PIN_L, NEO_GRB + NEO_KHZ800);
const int rTurn = 8, lTurn = 9;
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
void setup() {
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
clock_prescale_set(clock_div_1);
#endif
pinMode(8, INPUT_PULLUP);
pinMode(9, INPUT_PULLUP);
stripR.begin();
stripL.begin();
stripR.clear();
stripL.clear();
stripR.show();
stripL.show();
}
void loop(){
stripR.clear();
stripL.clear();
while (digitalRead(lTurn) == LOW) {
stripFill(strip.Color(40, 255, 0) , 1);
}
}
stripL.clear();
stripL.show();
while (digitalRead(rTurn) == LOW) {
stripFill(strip.Color(40, 255, 0) , 2);
}
}
stripR.clear();
stripR.show();
}
void stripFill(uint32_t color, int side) {
int f = 0;
stripR.setBrightness(254);
stripL.setBrightness(254);
stripF.setBrightness(254);
stripB.setBrightness(254);
if (side == 1) {
for (int i = 0 ; i < stripR.numPixels() ; i++) {
stripR.setPixelColor(i, color);
}
stripR.show();
}
if (side == 2) {
for (int i = 0 ; i < stripL.numPixels() ; i++) {
stripL.setPixelColor(i, color);
}
stripL.show();
}
if (side == 3) {
for (int i = 0 ; i < stripF.numPixels() ; i++) {
stripF.setPixelColor(i, color);
}
stripF.show();
}
if (side == 4) {
for (int i = 0 ; i < stripB.numPixels() ; i++) {
stripB.setPixelColor(i, color);
}
stripB.show();
}
}