#include <FastLED.h>
#include <SD.h>
#define LED_PIN 7
#define NUM_LEDS 256
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
Serial.begin(115200);
Serial.print("Initializing SD card... ");
if (!SD.begin(4)) {
Serial.println("Card initialization failed!");
return;
}
Serial.println("initialization done.");
Serial.println("opening frame1");
File file = SD.open("frame1.txt");
if (!file) {
Serial.println("Failed to open file");
return;
}
Serial.println("opened frame1");
int data[NUM_LEDS];
int count = 0;
while (file.available()) {
String line = file.readStringUntil('\n');
// Serial.println(line);
data[count] = strtol(line.c_str(), NULL, 0);
count++;
}
file.close();
// for(int i = 0; i < NUM_LEDS; i++)
// {
// Serial.println(data[i]);
// }
for (int i = 0; i < NUM_LEDS; i++) {
leds[i] = data[i];
}
FastLED.show();
}
void loop() {
// do nothing
}