alright, I have a problem converting a string to float…
// inputmsg = "2.5 metres"
// chop up into words
pch = strtok (inputMsg," ,-");
i=0;
while (pch != NULL)
{
i++;
if (i==1)
{
rcvpacket.distance = atof(pch); //if printf as %f = 2.50000, if printf as %d = 1 :confused:
rcvpacket.distance = rcvpacket.distance + 3.141592654; // just adding PI..could be any decimal number
printf ("distance: %f
",rcvpacket.distance); // prints out 7.141593 instead of 5.641592654.
}
…
}
i’m using an RCM3900… if that could be the problem…?