Go Down

Topic: bug: EEPROM.write function (Read 2493 times) previous topic - next topic


hi. This also was discussed in old forum here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1258047495

You should really change the EEPROM.write example as it is wrong and are somehow confusing.
In the beginning you say that epprom value can be 0 - 255,  then in the example when i reaches 256 you write that value into eeprom.
for (int i = 0; i < 512; i++)
   EEPROM.write(i, i);


I expect the value being passed to the EEPROM function is truncated to a byte.  When i==256 the value written to EEPROM will be 0.  I agree that an example that relies on that truncation is bad practice and will cause confusion.
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

Go Up