Go Down

Topic: Help with EEPROM.write() (Read 619 times) previous topic - next topic


Hi, I am simply trying to write a byte of data to the EEPROM and then read it to the serial port as shown with the following code:
Code: [Select]
#include <EEPROM.h>

byte data[1] = {192};
int a = 1;
int value;

void setup()
 EEPROM.write(a, data[1]);

void loop()
 value = EEPROM.read(a);

But all the serial window shows is "1       1".  Meaning that the value stored at EEPROM Address 1 is 1.  But the value written should 192 right?  Am I missing something really simple here?


Coding Badly

Code: [Select]
 EEPROM.write(a, data[[glow]0[/glow]]);
...C indexes are zero based.


wow I can't believe I missed that.  its a first time of programming for me
thanks a lot

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131