system
October 6, 2010, 8:11am
1
Good morning
I need your help once again.
Given var CursorPosActual_temp and temp...
int CursorPosActual_temp;
float temp;
Some simple math...
CursorPosActual_temp=6;
temp=CursorPosActual_temp/10;
doing...
Serial.println(temp);
Result on PC screen is '0.00'
Why do I have a result '0' instead '0.6' ?
I'll appreciate your help
Thanks on advance
Best regards
Pedro Ferrer
system
October 6, 2010, 8:20am
2
The conversion integer to float happens after the division, because 10 is considered an integer too. To force a conversion to float before the division, at least one part needs to be a float.
Try this instead:
temp=CursorPosActual_temp/10[glow].0[/glow];
Korman
system
October 6, 2010, 8:36am
3
Thanks Korman
I've forgot that issue!
I've already used before on same project...
Thanks once again
Best regards
Pedro Ferrer