I have project using ESP8266 and the SD card to make Pixel Led Animation
The Animation file is Store in SD as "RGBmatrix.dat" and the following code is working 100%
But I need to reed another file in SD card Name "Config.txt" whish is having 2 lines
NUM_LEDS= 168
PIXEL_TYPE= WS2811
so following line setting should be as per the config file data.
FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
so how I can get this setting values to store for above line.
following is the code which is working by giving WS2812 and NUM_LEDS
But I need to get those values from Config.txt file
#include <FastLED.h>
#include <SPI.h>
#include <SD.h>
#define NUM_LEDS 168
#define DATA_PIN D3
#define PIN_SPI_CS D8
#define BRTNS 160
File fxdata;
CRGB leds[NUM_LEDS];
void setup()
{
//FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS); //se doc for different LED strips
FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
// Serial.begin(BAUD_RATE); // when using Glediator via usb
FastLED.setBrightness(BRTNS);
for(int y = 0 ; y < NUM_LEDS ; y++)
{
leds[y] = CRGB::Black; // set all leds to black during setup
}
FastLED.show();
pinMode(10, OUTPUT); // CS/SS pin as output for SD library to work.
digitalWrite(10, HIGH); // workaround for sdcard failed error...
if (!SD.begin(PIN_SPI_CS))
{
Serial.println("sdcard initialization failed!");
return;
}
Serial.println("sdcard initialization done.");
// test file open
fxdata = SD.open("RGBmatrix.dat"); // read only
if (fxdata)
{
Serial.println("file open ok");
fxdata.close();
}
}
// close the file in order to prevent hanging IO or similar throughout time
fxdata.close();
}