I’m having this code reading data from sd card and send to leds only the buttons are not working because it first handles the whole while loop from sd card, how to fix this anyone?
if(button4.fell()){
if (AutoState == 0){
AutoState = 1;
} else if (AutoState == 1){
AutoState = 0;
}
}
fxdata = SD.open(“pakje723.dat”); // read only
if (fxdata)
{
Serial.println(“file open ok”);
}
while (fxdata.available())
{
/for (int i=0; i < NUM_LEDS_total; i++) {
tmp[i].r = fxdata.read();
tmp[i].g = fxdata.read();
tmp[i].b = fxdata.read();
}/
fxdata.readBytes((char*)tmp, NUM_LEDS_total * 3);
for (int i=0; i < NUM_LEDS_total; i++) {
//leds[i] = tmp[i];
colourStore[XYTable[i]] = tmp[i];
}
//Left Arm
for(int x=0;x<73;x++) {
leftArmTop[x]= colourStore[leftArmTopArray[x]];
}
for(int x=0;x<70;x++) {
leftArmBottom[x]= colourStore[leftArmBottomArray[x]];
}
//Right Arm
for(int x=0;x<73;x++) {
rightArmTop[x]= colourStore[rightArmTopArray[x]];
}
for(int x=0;x<70;x++) {
rightArmBottom[x]= colourStore[rightArmBottomArray[x]];
}
//Chest
for(int x=0;x<355;x++) {
chestMain[x]= colourStore[chestMainArray[x]];
}
for(int x=0;x<70;x++) {
chestLeft[x]= colourStore[chestLeftArray[x]];
}
for(int x=0;x<80;x++) {
chestMiddle[x]= colourStore[chestMiddleArray[x]];
}
for(int x=0;x<70;x++) {
chestRight[x]= colourStore[chestRightArray[x]];
}
FastLED.setBrightness(brightnessCounter);
FastLED.show();
FastLED.delay(25);
}
fxdata.close();