Go Down

Topic: eeprom (Read 419 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
 


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!

Arduino
via Egeo 16
Torino, 10131
Italy