user69011: I have a loop command reading temperature sensor data from 8 thermistors and are storing them as floats into an array. Instead of printing to Serial on each iteration, I would like to create a comma separated string of these values and send to serial (in one instance, versus 8). What would be the best way to do this? I have tried sprintf commands to no avail.
Thanks in advance!
Edit: I would like to also write this string of comma separated values to a MicroSD card slot so I am under the assumption that creating the string once and printing to Serial AND saving to MicroSD card is more efficient than 8 separate iterations

user4143: Basic Arduinos have no support for floating point in sprintf and related functions.
Instead you have to use dtostrf() to build up a string block by block.
However there is no benefit to building a string then outputting to serial "in one instance" compared to outputting the data a bit at a time.  Serial is slow. Very slow. When you "output" data to serial you aren't outputting data. You're merely putting the data into a buffer to be sent when it's possible.
In effect, by using multiple Serial.print() calls, you're building up the string to send in the Arduino's internal serial TX buffer.
By building the string first all you're doing is creating a buffer to copy data into a buffer to send it through serial. It's redundant, wasteful, and utterly pointless.

69011: <p>I have a loop command reading temperature sensor data from 8 thermistors and are storing them as floats into an array. Instead of printing to Serial on each iteration, I would like to create a comma separated string of these values and send to serial (in one instance, versus 8). What would be the best way to do this? I have tried <code>sprintf</code> commands to no avail.</p>
<p>Thanks in advance!</p>
<p><em>Edit:</em> I would like to also write this string of comma separated values to a MicroSD card slot so I am under the assumption that creating the string once and printing to Serial AND saving to MicroSD card is more efficient than 8 separate iterations</p>
 4143: <p>Basic Arduinos have no support for floating point in <code>sprintf</code> and related functions.</p>
<p>Instead you have to use <code>dtostrf()</code> to build up a string block by block.</p>
<p>However there is no benefit to building a string then outputting to serial &quot;in one instance&quot; compared to outputting the data a bit at a time.  Serial is slow. Very slow. When you &quot;output&quot; data to serial you aren't outputting data. You're merely putting the data into a buffer to be sent when it's possible.</p>
<p>In effect, by using multiple <code>Serial.print()</code> calls, you're building up the string to send in the Arduino's internal serial TX buffer.</p>
<p>By building the string first all you're doing is creating a buffer to copy data into a buffer to send it through serial. It's redundant, wasteful, and utterly pointless.</p>
