Mapping float to int


I would like to map a float variable which is a sine wave that ranges from -100.00 to +20.00 to a 16 bit unsigned int between 743 and 3717. The issue i am having is that the int will only change when the float value changes by a whole number. The value of "dewpoint" is calculated from humidity and temperature which are sent over I2C from another device.
SendingDew = map(dewpoint, -100.0, 20.0, 743, 3717);

I would appreciate any advice, Thank you.

Multiply the float by 100 and use the new value in map()

1 Like

Thank you :smiley:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.