Hi all,
Im wondering how im able to store data that comes in over serial to progmem.
Reason being i woud like to use the data after my arduino has had power removed and re-applied to it.
Right now the data that comes in over serial is stored to:
char inData2[12]; // Allocate some space for the string
I am able to print this over serial or to an oled screen via:
Serial.println(inData2); or oled.println(inData2);
But how would i then store "inData2" to progmem? and then call it back for use "Serial.println(NEW-PROGMEM-INDATA)"
But cant work out how to use this for my purposes.. Any ideas?
Go through the examples line by line to understand what each line does, and try the examples out. Make some modifications and see what happens. If you are still stuck after that, post a specific question.
I'd have to say, if you're writing strings, then EEPROMWriteAnything isn't a lot of use, but you'd normally be writing fixed length items into EEPROM, to make them more easily accessible.
The code that ive put up is probably completely wrong.
But am i going the right way about it?
#include <EEPROM.h>
#include "EEPROMAnything.h"
struct config_t
{
char inData2[12]; // Allocate some space for the string
long alarm;
int mode;
} configuration;
void setup()
{
Serial.begin(9600);
EEPROM_readAnything(0, configuration);
// ...
}
void loop()
{
// let the user adjust their alarm settings
// let the user adjust their mode settings
// ...
Serial.println(inData2);
// if they push the "Save" button, save their configuration
if (digitalRead(13) == HIGH)
EEPROM_writeAnything(0, configuration);
}