Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

String Concatenation with Long

$
0
0

Hi Guys,

 

I've posted an issue over on the Ti website but they have suggested posting in an Energia forum too.

 

The issue I am seeing is when concatenating a string and a long number. It either goes one of two ways - the value is zeros, or the numbers following the decimal point are missing.

 

https://e2e.ti.com/support/wireless_connectivity/f/968/t/414222

//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);

The following gives zeros:

String pubString = "Temperature Test ";
  
pubString  += diet;

Serial.print(pubString);

Thanks

 


Viewing all articles
Browse latest Browse all 2077

Trending Articles