Go Down

Topic: eeprom (Read 399 times) previous topic - next topic

nooty

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

nooty

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

billroy

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

Tom Carpenter

Just cast it to an unsigned value:
Code: [Select]
char value = -121;
EEPROM.write(address,(byte)value);
value = (char) EEPROM.read(address);
~Tom~

billroy

Please don't cross post.

Thanks,

-br

Nick Gammon

Also see: http://playground.arduino.cc/Code/EEPROMWriteAnything
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

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

Threads merged.

- Moderator
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up