<?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 convert 2&amp;#39;s complement ADXL345 data to nRF51 UART? needed help</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/27940/how-to-convert-2-s-complement-adxl345-data-to-nrf51-uart-needed-help</link><description>finally I have done to implement that ADXL345 can throw data over BLE using nRF UART app service with this code . now my problem is how to change 2&amp;#39;s complement ADXL345 data to array of string/character. 
 here it is the data using nRF51 uart app
 </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 07 Dec 2017 10:20:16 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/27940/how-to-convert-2-s-complement-adxl345-data-to-nrf51-uart-needed-help" /><item><title>RE: how to convert 2's complement ADXL345 data to nRF51 UART? needed help</title><link>https://devzone.nordicsemi.com/thread/110279?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2017 10:20:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:56404583-678f-46bd-8534-fc43960f76dc</guid><dc:creator>mantap</dc:creator><description>&lt;p&gt;thank you so much mr. sigurd, you are awesome.. long time to know how it&amp;#39;s work this code..
what do you call this method, I wanna write your name in my journal project...
thank so much, I appreciate your answer...
so this is &lt;a href="https://os.mbed.com/users/asyrofi/code/nRF51_ADXL345_UART/"&gt;last program&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to convert 2's complement ADXL345 data to nRF51 UART? needed help</title><link>https://devzone.nordicsemi.com/thread/110278?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2017 09:19:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26ad1394-3488-478a-b14c-4b4f035dba18</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Try something like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; char buffer [20];

 // Test data
 memset(&amp;amp;buffer, 0, sizeof(buffer));
int16_t reading_1 = 54;
int16_t reading_2 =42;
int16_t reading_3 = 32;
snprintf(buffer,20 ,&amp;quot;data: %d, %d, %d\n&amp;quot;, reading_1, reading_2, reading_3);
 
 while (1) 
 {
     ble.waitForEvent();
     wait(0.1);
     accelerometer.getOutput(readings);
     uart1.printf(&amp;quot;%i, %i, %i\n&amp;quot;, (int16_t)readings[0], (int16_t)readings[1], (int16_t)readings[2]);
     
     memset(&amp;amp;buffer, 0, sizeof(buffer));
     snprintf(buffer,20 ,&amp;quot;data: %d, %d, %d\n&amp;quot;, (int16_t)readings[0], (int16_t)readings[1], (int16_t)readings[2]);

 ble.updateCharacteristicValue(uartServicePtr-&amp;gt;getRXCharacteristicHandle(), (uint8_t*)buffer,sizeof(buffer),false/*bytesRead*/);

}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to convert 2's complement ADXL345 data to nRF51 UART? needed help</title><link>https://devzone.nordicsemi.com/thread/110277?ContentTypeID=1</link><pubDate>Thu, 07 Dec 2017 01:48:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e7d0c77-4d58-41d7-9120-c739ed093ed7</guid><dc:creator>mantap</dc:creator><description>&lt;p&gt;still error bro, can you make it code simple..
write your example code that fix char buffer..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to convert 2's complement ADXL345 data to nRF51 UART? needed help</title><link>https://devzone.nordicsemi.com/thread/110275?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2017 08:04:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f80df904-fa6f-42a7-ac7b-20b75217c067</guid><dc:creator>max</dc:creator><description>&lt;p&gt;char tests[BUFFER_LEN] = {0}&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;snprintf((char *)tests,BUFFER_LEN,&amp;quot;%i, %i, %i\n&amp;quot;, (int16_t)readings[0], (int16_t)readings[1], (int16_t)readings[2]);     
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;send a tests array with your function as 20 B chunks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to convert 2's complement ADXL345 data to nRF51 UART? needed help</title><link>https://devzone.nordicsemi.com/thread/110276?ContentTypeID=1</link><pubDate>Wed, 06 Dec 2017 01:04:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:63a42576-1d57-4907-a05a-393e441e3bdd</guid><dc:creator>mantap</dc:creator><description>&lt;p&gt;thank you for your answer, can you explained with the code please..
where is should I take fill a char buffer using sprint to code..&lt;/p&gt;
&lt;p&gt;are take it to here?&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; while (1) 
{
  ble.waitForEvent();
  wait(0.1);
  accelerometer.getOutput(readings);
  uart1.printf(&amp;quot;%i, %i, %i\n&amp;quot;, (int16_t)readings[0], (int16_t)readings[1], (int16_t)readings[2]);
  ble.updateCharacteristicValue(uartServicePtr-&amp;gt;getRXCharacteristicHandle(), (const uint8_t*)readings[0], sizeof(readings),false);
  ble.updateCharacteristicValue(uartServicePtr-&amp;gt;getRXCharacteristicHandle(), (const uint8_t*)readings[1], sizeof(readings),false);
  ble.updateCharacteristicValue(uartServicePtr-&amp;gt;getRXCharacteristicHandle(), (const uint8_t*)readings[2], sizeof(readings),false);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;because send over BLE should have method to change 2&amp;#39;s complement ADXL345 (16 bit) to nrf51 (10 bit) that change that complement to string of array. I still confuse&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: how to convert 2's complement ADXL345 data to nRF51 UART? needed help</title><link>https://devzone.nordicsemi.com/thread/110274?ContentTypeID=1</link><pubDate>Tue, 05 Dec 2017 09:06:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b55dc157-46e6-4a49-ad16-4aab6b0336a5</guid><dc:creator>max</dc:creator><description>&lt;p&gt;You can fill a char* buffer using sprintf(), then send this buffer via nus&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>