Hai friend
Can any one help me to clear this error . This is a simple pixel led animation and there is compile error in this
Following is the code
#include <Adafruit_NeoPixel.h>
#define NUM_COLS 8
#define NUM_ROWS 7
#define NUM_LED (NUM_COLS * NUM_ROWS) // Calculate total number of LEDs
#define DATA_PIN D8
#define Speed 100
#define BRTNS 90
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LED, DATA_PIN, NEO_GRB + NEO_KHZ800);
enum class Animation {
Frame0, Frame1,Frame2,Frame3,Frame4,Frame5,Frame6,Frame7,
}
const uint32_t animationFrames[8][NUM_LED] = {
Frame0 = {
0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000,
0x00000000, 0x0000FF00, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF,
0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x00000040, 0x0000FF00,
0x0000FF00, 0x00000040, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF,
0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x00000040, 0x0000FF00,
0x0000FF00, 0x00000040, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF,
0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x0000FF00, 0x00000000,
0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00,
};
Frame1 = {
0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000,
0x0000FF00, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF, 0x00000000,
0x0000FF00, 0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x00000040,
0x00000040, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF, 0x0000FF00,
0x0000FF00, 0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x00000040,
0x00000040, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF, 0x0000FF00,
0x00000000, 0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x0000FF00,
0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000,
};
Frame2 = {
0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00,
0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF, 0x00000000, 0x0000FF00,
0x00000040, 0x0000FF00, 0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060,
0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF, 0x0000FF00, 0x00000040,
0x00000040, 0x0000FF00, 0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060,
0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF, 0x0000FF00, 0x00000040,
0x0000FF00, 0x00000000, 0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060,
0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000,
};
Frame 3= {
0x0000FF00, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00,
0x00000080, 0x000000C0, 0x000000E0, 0x000000FF, 0x00000000, 0x0000FF00, 0x00000060,
0x00000060, 0x00000040, 0x0000FF00, 0x000000FF, 0x000000E0, 0x000000C0, 0x00000080,
0x00000080, 0x000000C0, 0x000000E0, 0x000000FF, 0x0000FF00, 0x00000040, 0x00000060,
0x00000060, 0x00000040, 0x0000FF00, 0x000000FF, 0x000000E0, 0x000000C0, 0x00000080,
0x00000080, 0x000000C0, 0x000000E0, 0x000000FF, 0x0000FF00, 0x00000040, 0x00000060,
0x00000060, 0x0000FF00, 0x00000000, 0x000000FF, 0x000000E0, 0x000000C0, 0x00000080,
0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x0000FF00,
};
Frame 4= {
0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00,
0x000000C0, 0x000000E0, 0x000000FF, 0x00000000, 0x0000FF00, 0x00000060, 0x00000080,
0x00000080, 0x00000060, 0x00000040, 0x0000FF00, 0x000000FF, 0x000000E0, 0x000000C0,
0x000000C0, 0x000000E0, 0x000000FF, 0x0000FF00, 0x00000040, 0x00000060, 0x00000080,
0x00000080, 0x00000060, 0x00000040, 0x0000FF00, 0x000000FF, 0x000000E0, 0x000000C0,
0x000000C0, 0x000000E0, 0x000000FF, 0x0000FF00, 0x00000040, 0x00000060, 0x00000080,
0x00000080, 0x00000060, 0x0000FF00, 0x00000000, 0x000000FF, 0x000000E0, 0x000000C0,
0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00,
};
Frame 5= {
0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00,
0x000000E0, 0x000000FF, 0x00000000, 0x0000FF00, 0x00000060, 0x00000080, 0x000000C0,
0x000000C0, 0x00000080, 0x00000060, 0x00000040, 0x0000FF00, 0x000000FF, 0x000000E0,
0x000000E0, 0x000000FF, 0x0000FF00, 0x00000040, 0x00000060, 0x00000080, 0x000000C0,
0x000000C0, 0x00000080, 0x00000060, 0x00000040, 0x0000FF00, 0x000000FF, 0x000000E0,
0x000000E0, 0x000000FF, 0x0000FF00, 0x00000040, 0x00000060, 0x00000080, 0x000000C0,
0x000000C0, 0x00000080, 0x00000060, 0x0000FF00, 0x00000000, 0x000000FF, 0x000000E0,
0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00,
};
Frame 6 = {
0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000, 0x0000FF00,
0x000000FF, 0x00000000, 0x0000FF00, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0,
0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x00000040, 0x0000FF00, 0x000000FF,
0x000000FF, 0x0000FF00, 0x00000040, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0,
0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x00000040, 0x0000FF00, 0x000000FF,
0x000000FF, 0x0000FF00, 0x00000040, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0,
0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x0000FF00, 0x00000000, 0x000000FF,
0x0000FF00, 0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00,
};
Frame 7 = {
0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x00000000, 0x00000000,
0x00000000, 0x0000FF00, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF,
0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x00000040, 0x0000FF00,
0x0000FF00, 0x00000040, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF,
0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x00000040, 0x0000FF00,
0x0000FF00, 0x00000040, 0x00000060, 0x00000080, 0x000000C0, 0x000000E0, 0x000000FF,
0x000000FF, 0x000000E0, 0x000000C0, 0x00000080, 0x00000060, 0x0000FF00, 0x00000000,
0x00000000, 0x00000000, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00, 0x0000FF00,
};
};
void setup() {
pinMode(DATA_PIN, OUTPUT);
strip.begin();
strip.setBrightness(BRTNS);
strip.show();
int animation = 0; // Current animation frame
}
void loop() {
for (int animation = 0; animation < 8; animation++) {
for (int frame = 0; frame < NUM_LED; frame++) {
strip.setPixelColor(frame, animationFrames[animation][frame]);
}
strip.show();
delay(Speed);
}
}
and following is the error
C:\Users\Manoj\Desktop\ESP1TESTING\ESP1TESTING_2\ESP1TESTING_2.ino:17:16: error: expected initializer before 'animationFrames'
17 | const uint32_t animationFrames[8][NUM_LED] = {
| ^~~~~~~~~~~~~~~
C:\Users\Manoj\Desktop\ESP1TESTING\ESP1TESTING_2\ESP1TESTING_2.ino: In function 'void loop()':
C:\Users\Manoj\Desktop\ESP1TESTING\ESP1TESTING_2\ESP1TESTING_2.ino:113:34: error: 'animationFrames' was not declared in this scope
113 | strip.setPixelColor(frame, animationFrames[animation][frame]);
| ^~~~~~~~~~~~~~~
exit status 1
Compilation error: expected initializer before 'animationFrames'