Hi all,ime wanting to know how i would wright an array of bytes to eeprom on esp8266.
ive an led pattern in a header file like this bellow.
ive cut some bytes off the patterns so its not too big for this post.
#ifndef DefaultPatterns_h
#define DefaultPatterns_h
#define DEFAULT_SIZE 147
const byte defaultData[DEFAULT_SIZE] PROGMEM = {0,0,0,0,0,0,0,0,0,251,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,251,255,0,255,170,0,251,255,0,0,0,0,0,0,0,0,0,0,251,255,0,255,170,0,255,0,0,255,170,0,251,255,0,0,0,0,251,255,0,255,170,0,255,0,0,255,255,255,255,0,0,255,170,0,251,255,0,0,0,0,251,255,0,255,170,0,255,0,0,255,170,0,251,255,0,0,0,0,0,0,0,0,0,0,251,255,0,255,170,0,251,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,251,255,0,0,0,0,0,0,0,0,0,0};
#define RAINBOWPIXEL_SIZE 972
const byte rainbowpixelData[RAINBOWPIXEL_SIZE] PROGMEM = {255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
#endif
ive cut some bytes off so its not too big for this post
Hear is my sketch bellow.
#include <EEPROM.h>
#include "defaultPatterns.h"
int addr = 0;// the current address in the EEPROM (i.e. which byte we're going to write to next)
void setup()
{
EEPROM.begin(512);
}
void loop(){
Serial.begin(9600);
const byte somedata[] = (defaultData,DEFAULT_SIZE, PROGMEM);// stuck on this part hear.!!!!!!
// EEPROM.write(addr, val);// was like this before.
EEPROM.write(addr,byte,somedata, sizeof(somedata)); // Stuck on this part hear.!!!!!!!!!!!!
addr = addr + 1;
if (addr == 512)
{
addr = 0;
EEPROM.commit();
}
delay(100);
}
Any help would be great