This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Add Float to String Variable

Other Parts Discussed in Thread: CC3200, ENERGIA, TMP006

Hi,


I have been trying to add the temperature value from my cc3200 to a string variable, but it seems to remove everything after the decimal point.

Here is the code I am using:

//This works fine
static float diet = tmp006.readDieTempC();
Serial.print("Die Temperature: "); Serial.print(diet); Serial.println("*C");

//This doesnt
String pubString = "Temperature " + long(diet);
Serial.print(pubString);

I have tried some of the dtostrf examples, but I am just gettings zeros.

Thanks