How do you convert a String to a float or int?

后端 未结 5 1604
醉酒成梦
醉酒成梦 2021-02-19 03:56

In an Arduino program I\'m working on the GPS sends the coordinates to the arduino through USB. Because of this, the incoming coordinates are stored as Strings. Is there any way

5条回答
  •  既然无缘
    2021-02-19 04:42

    How about sscanf(curLongitude, "%i", &gpslong) or sscanf(curLongitude, "%f", &gpslong)? Depending on how the strings look, you might have to modify the format string, of course.

提交回复
热议问题