char test[8]="TESTi10";
void setup(){
EEPROM.begin(20);
for(int cc=0 ;cc<9;cc++){
int value = test[cc]-'0'; //convert char to int
EEPROM.put(cc,value);
EEPROM.end();
delay(20);
Serial.println(value);
delay(500);
}
}
I get this in terminal(not bad):
36
21
35
36
57
1
0
-48
-39
But when I read the stored data with the following code:
void loop(){
EEPROM.begin(20);
for(int cd=0;cd<9;cd++){
EEPROM.get(cd,raw[cd]);
}
EEPROM.commit();
EEPROM.end();
for(int cd=0;cd<9;cd++){
Serial.println(raw[cd]);
}
}
I get this in terminal:
36
956301312
20512768
80128
-805306055
-640679935
-2502656
-9776
-39
as you can see only the first character saved on eeprom and others are rubish!
WHY ??