Pages: [1]   Go Down
Author Topic: eeprom  (Read 353 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

guys, do you know how to write negative value on eeprom..
could you give me some simple code/example?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

guys, do you know how to write negative value on eeprom in a simple way?
thx
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 986
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Negative values are written the same way as any other values.  It's all just bits, right?

There are code samples here: http://arduino.cc/en/Reference/EEPROM

-br
Logged

Leeds, UK
Offline Offline
Edison Member
*
Karma: 71
Posts: 1641
Once the magic blue smoke is released, it won't go back in!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Just cast it to an unsigned value:
Code:
char value = -121;
EEPROM.write(address,(byte)value);
value = (char) EEPROM.read(address);
Logged

~Tom~

0
Offline Offline
God Member
*****
Karma: 39
Posts: 986
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please don't cross post.

Thanks,

-br
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Also see: http://playground.arduino.cc/Code/EEPROMWriteAnything
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 452
Posts: 18694
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please do not cross-post. This wastes time and resources as people attempt to answer your question on multiple threads.

Threads merged.

- Moderator
Logged

Pages: [1]   Go Up
Jump to: