Convert uint16 to int16

Status
Not open for further replies.

Manu

Well-known member
Hello,

Is there a simple and effective way to convert a uint16 value to a int16 value ?

Turrently I use this :

Code:
tMot.mini = EEPROM.readInt(25);
if (tMot.mini > 65000) tMot.mini = tMot.mini - 65536;

readInt send an uint16_t value, so if the real value is -10, I get 65531.

I tried :
Code:
tMot.mini = (int)EEPROM.readInt(25);

But it don't work.
Thank you,
Manu
 
Status
Not open for further replies.
Back
Top