EEPROM with negative numbers

I need to save accelerometer values to the EEPROM so that when my Uno starts up again, it doesn't need to be re-calibrated.

EEPROM.write(0, trigger); //the float (trigger) is converted to an int, which is okay EEPROM.read(0); //when I read and save it to a float var it seems to be okay

I need to save negative numbers, a simple eeprom.write() won't do it.

I read this article : http://playground.arduino.cc/Code/EEPROMWriteAnything, but it didn't really helped.

I'm not exactly sure how to use a signed or cast function, I'm a little stumped. I just want to be able to save a negative number from 0 to -255 (an angle to start a motor) into the eeprom and be able to retrieve it.

AliH: I'm not exactly sure how to use a signed or cast function, I'm a little stumped. I just want to be able to save a negative number from 0 to -255 (an angle to start a motor) into the eeprom and be able to retrieve it.

Isf the range is 0 to -255 or -255 to 255? The former can be stored in a single byte, the latter will need to be stored in two bytes.

I read this article : http://playground.arduino.cc/Code/EEPROMWriteAnything, but it didn’t really helped.

It would seem to me it’s an ideal solution - why didn’t it help?

If it's 0 to -255 why not just take the sign as read? Just store 0-255, which is, um, a byte?