<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Send 2 values on same line via ble nus</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15586/send-2-values-on-same-line-via-ble-nus</link><description>Hi, 
 i am working on a custom board with nRF51422. I can program this board with the nRF51-DK. I use ADC and a temperature sensor via I2C. Everything work well but actually I send the ADC value then 1 second later I send temperature value. I use sprintf</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 05 Aug 2016 14:42:08 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15586/send-2-values-on-same-line-via-ble-nus" /><item><title>RE: Send 2 values on same line via ble nus</title><link>https://devzone.nordicsemi.com/thread/59471?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2016 14:42:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9019010c-ad0f-43b6-97c6-2bef502271eb</guid><dc:creator>kwentin</dc:creator><description>&lt;p&gt;Thanks for your comment, it works.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send 2 values on same line via ble nus</title><link>https://devzone.nordicsemi.com/thread/59469?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2016 14:41:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:80af0468-750c-4257-808d-2025f9c855c8</guid><dc:creator>kwentin</dc:creator><description>&lt;p&gt;Thanks, that&amp;#39;s perfect !&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send 2 values on same line via ble nus</title><link>https://devzone.nordicsemi.com/thread/59468?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2016 13:42:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d33b89ed-4875-4e1c-978f-9cd64d266858</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;Just do a single &lt;strong&gt;sprintf()&lt;/strong&gt; call to put both the values into a single string, then send it.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;sprintf( string_buffer, &amp;quot;ADC : %.2f V; Temp : %.2f C&amp;quot;, voltage_value, temp );
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As already noted, maximum string length is 20 characters.&lt;/p&gt;
&lt;p&gt;BTW: what was with all that casting?!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Send 2 values on same line via ble nus</title><link>https://devzone.nordicsemi.com/thread/59470?ContentTypeID=1</link><pubDate>Fri, 05 Aug 2016 13:07:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f46c14af-fed2-41b1-a340-d781f7c38738</guid><dc:creator>RichieJH</dc:creator><description>&lt;p&gt;Sure is possible.  Co-join those two strings into one and send that.  Be aware the new string needs to have a length of 20 bytes or less in total, so you may have to shorten some of your text around the values.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>