Pages: [1]   Go Down
Author Topic: bug: EEPROM.write function  (Read 1541 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 6
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi. This also was discussed in old forum here:

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);

Massachusetts, USA
Offline Offline
Tesla Member
Karma: 212
Posts: 8933
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Pages: [1]   Go Up
Jump to: