I have a float variable lng = 33.785469 and lat = 78.126548. Now can I convert them to String and append in a String variable "my_location" as "your location is \nlng = 33.785469 \nlat = 78.126548". I was trying to do this with
char charVal[5]; //temporarily holds data from vals
String stringVal = ""; //data on buff is copied to this string
dtostrf(lng , 4, 2, charVal); //4 is mininum width, 2 is precision; float value is copied onto buff
//convert chararray to string
for(int i=0;i<sizeof(charVal);i++)
{
stringVal+=charVal[i];
}
GPS_string = GPS_string + "Car location: \nlat:" + stringVal;
stringVal = "";
and it given me an error :
error: cannot convert 'String' to 'double' for argument '1' to 'char* dtostrf(double, signed char, unsigned char,