<?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>how to send the float to string over ble_nus</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48419/how-to-send-the-float-to-string-over-ble_nus</link><description>hi, 
 I am working on temperature sensor i merged the uart and twi sensor , using nrf52832 + Max30205 (temperature sensor) . i am getting the temperature in float which is printing in debug terminal , how to send the float over ble_nus _send . for that</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 11 Jun 2019 12:36:09 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48419/how-to-send-the-float-to-string-over-ble_nus" /><item><title>RE: how to send the float to string over ble_nus</title><link>https://devzone.nordicsemi.com/thread/192072?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2019 12:36:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:589f5d03-42de-4d6f-b66b-cb1dafbac0c8</guid><dc:creator>awneil</dc:creator><description>&lt;p&gt;As&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/joh2"&gt;Jørgen Holmefjord&lt;/a&gt;&amp;nbsp;said in your duplicate thread,&lt;/p&gt;
[quote userid="14926" url="~/f/nordic-q-a/48350/issue-in-sending-the-float-value-in-ble_nus_send/192061"]If you do not get any value, there is most likely some other issue[/quote]
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/48350/issue-in-sending-the-float-value-in-ble_nus_send/192061#192061"&gt;devzone.nordicsemi.com/.../192061&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So perhaps you should just continue in that thread.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to send the float to string over ble_nus</title><link>https://devzone.nordicsemi.com/thread/191999?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2019 09:56:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:515f0dc0-e4fd-4fdf-9176-76ae168db9f3</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;no in nRF toolbox&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to send the float to string over ble_nus</title><link>https://devzone.nordicsemi.com/thread/191965?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2019 08:52:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c6875f6-3e47-4a6f-8f03-83a650695193</guid><dc:creator>awneil</dc:creator><description>[quote userid="74848" url="~/f/nordic-q-a/48419/how-to-send-the-float-to-string-over-ble_nus/191953"]nRF app uart[/quote]
&lt;p&gt;You mean this:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://play.google.com/store/apps/details?id=com.nordicsemi.nrfUARTv2&amp;amp;hl=en_GB"&gt;https://play.google.com/store/apps/details?id=com.nordicsemi.nrfUARTv2&amp;amp;hl=en_GB&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to send the float to string over ble_nus</title><link>https://devzone.nordicsemi.com/thread/191964?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2019 08:49:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de45a401-0960-403e-a88f-50dd3cfa9261</guid><dc:creator>awneil</dc:creator><description>[quote userid="74848" url="~/f/nordic-q-a/48419/how-to-send-the-float-to-string-over-ble_nus/191958"]incompatible type of argument 2 in ble_nus_send[/quote]
&lt;p&gt;That&amp;#39;s a standard &amp;#39;C&amp;#39; language error - nothing specific to Nordic or BLE.&lt;/p&gt;
&lt;p&gt;See your &amp;#39;C&amp;#39; textbook for the &amp;#39;C&amp;#39; language rules about types and their &amp;quot;compatibility&amp;quot; - and how to use a so-called &amp;quot;cast&amp;quot; to get around them ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to send the float to string over ble_nus</title><link>https://devzone.nordicsemi.com/thread/191958?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2019 08:39:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f5a5967-0d1e-472e-a732-0fbeae8eca7b</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;even i have tried to send the raw bytes of the float value . i am getting error , incompatible type of argument 2 in ble_nus_send()&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to send the float to string over ble_nus</title><link>https://devzone.nordicsemi.com/thread/191953?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2019 08:21:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3730bfee-9e2e-4413-9011-c1ac652e70e5</guid><dc:creator>ps_anu</dc:creator><description>&lt;p&gt;but i want to send the data&amp;nbsp; over ble in nRF app uart .&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to send the float to string over ble_nus</title><link>https://devzone.nordicsemi.com/thread/191946?ContentTypeID=1</link><pubDate>Tue, 11 Jun 2019 08:06:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89d5fa38-a142-45f0-9578-d7a0b6dca8e1</guid><dc:creator>awneil</dc:creator><description>[quote userid="74848" url="~/f/nordic-q-a/48419/how-to-send-the-float-to-string-over-ble_nus"]for that i need to convert into string right[/quote]
&lt;p&gt;Not necessarily.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;ble_nus_data_send()&lt;/strong&gt; just sends &lt;em&gt;&lt;strong&gt;bytes&lt;/strong&gt;&lt;/em&gt; - it neither knows nor cares what those bytes represent.&lt;/p&gt;
&lt;p&gt;So you could just send the raw bytes of the float value.&lt;/p&gt;
&lt;p&gt;The downside of that, of course, is that you won&amp;#39;t be able to just view it on a plain terminal - you will need to software on the receiving end which does understand the format, and can re-assemble those bytes into a float value (and, if required, display them in a meaningful, human-readable form).&lt;/p&gt;
&lt;p&gt;This applies to &lt;em&gt;&lt;strong&gt;any&lt;/strong&gt; &lt;/em&gt;form of communication - not specific to Nordic or BLE.&lt;/p&gt;
[quote userid="74848" url="~/f/nordic-q-a/48419/how-to-send-the-float-to-string-over-ble_nus"] i have done i have converted into string[/quote]
&lt;p&gt;This:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;length1 = sprintf(str,&amp;quot;%.2f&amp;quot;, tempC);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Have you checked that the conversion is actually working?&lt;/p&gt;
&lt;p&gt;The following code&amp;nbsp;is still using the length of the original float - not the length of your converted&amp;nbsp;string!&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;             ble_nus_data_send(&amp;amp;m_nus,str,sizeof(tempC), m_conn_handle);
             NRF_LOG_INFO(&amp;quot;Temperature: &amp;quot; &amp;quot;%s%d.%01d&amp;quot;, NRF_LOG_FLOAT(tempC));&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>