user29222: I recently purchased an nRF8001 Bluefruit LE and I am now trying to read/send data with an app. But I am not sure how I can write/send a double value. I want to send two double values at once and to successfully send this, do I have to convert these doubles to a byte array? If so I would very much appreciate how that would look!
This is documentation on how my module works:
https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout/nrf-uart-in-detail
Under the headline Writing data they give examples on how to send data but as far as I can see (I am a bit new to Arduino code) in their example they only send an int and a string.
I know how to read and set up the module, so it is only the writing/sending doubles that I am struggling with.
These are the two doubles that I wish to send and I control it with:
double valueOne;
double valueTwo;

The Bluetooth control:
Adafruit_BLE_UART BTLEserial = Adafruit_BLE_UART(ADAFRUITBLE_REQ, ADAFRUITBLE_RDY, ADAFRUITBLE_RST);

So if I for example do this:
BTLEserial.write(valueOne, valueTwo);

I get this message: no matching function for call to 'Adafruit_BLE_UART::write(double&, double&)'
So do I need to convert these two double values to a byte array and if so how would that look?
Appreciate every help, tips, code! :)

user28551: As the link "Adafruit - nRF UART In Detail" describes, the function write(sendbuffer, sendbuffersize); is waiting for a buffer of uint8_t followed by the size of the message.
Here are the step--by-step solution to send the 2 doubles by using that function.
Step1 - convert the floating-point values into a char string.

In the Arduino environment, the standard format-specifier %f or %lf
  is not well-managed and the function dtostrf() is recommended.

The format is char *   dtostrf (double __val, signed char __width, unsigned char __prec, char *__s) where:

__val is the floating-point value to be converted,
__s is the array of char to store the result,
__width is the number of characters to store the result,
__prec is the number of digit

The conversion is:
char sValueOne[16], sValueTwo[16];
char sBuffer[33];

strcpy(sBuffer,dtostrf(valueOne, 15, 8, sValueOne));
strcat(sBuffer,",");
strcat(sBuffer,dtostrf(valueTwo, 15, 8, sValueTwo));

Step2 - write the buffer over the BTLEserial object.
BTLEserial.write((uint8_t *)sBuffer, strlen(sBuffer));


Alternate output solution using BTLEserial.print() function.

BTLEserial.print(sBuffer);


29222: <p>I recently purchased an nRF8001 Bluefruit LE and I am now trying to read/send data with an app. But I am not sure how I can write/send a double value. I want to send two double values at once and to successfully send this, do I have to convert these doubles to a byte array? If so I would very much appreciate how that would look!</p>

<p>This is documentation on how my module works:
<a href="https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout/nrf-uart-in-detail" rel="nofollow noreferrer">https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout/nrf-uart-in-detail</a></p>

<p>Under the headline <code>Writing data</code> they give examples on how to send data but as far as I can see (I am a bit new to Arduino code) in their example they only send an int and a string.</p>

<p>I know how to read and set up the module, so it is only the writing/sending doubles that I am struggling with.</p>

<p>These are the two doubles that I wish to send and I control it with:</p>

<pre><code>double valueOne;
double valueTwo;
</code></pre>

<p>The Bluetooth control:</p>

<pre><code>Adafruit_BLE_UART BTLEserial = Adafruit_BLE_UART(ADAFRUITBLE_REQ, ADAFRUITBLE_RDY, ADAFRUITBLE_RST);
</code></pre>

<p>So if I for example do this:</p>

<pre><code>BTLEserial.write(valueOne, valueTwo);
</code></pre>

<p>I get this message: <code>no matching function for call to 'Adafruit_BLE_UART::write(double&amp;, double&amp;)'</code></p>

<p>So do I need to convert these two double values to a byte array and if so how would that look?</p>

<p>Appreciate every help, tips, code! :)</p>
 28551: <p>As the link <a href="https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout/nrf-uart-in-detail" rel="nofollow noreferrer">"Adafruit - nRF UART In Detail"</a> describes, the function <code>write(sendbuffer, sendbuffersize);</code> is waiting for a buffer of <code>uint8_t</code> followed by the size of the message.</p>

<p>Here are the step--by-step solution to send the 2 doubles by using that function.</p>

<p><strong>Step1</strong> - convert the floating-point values into a char string.</p>

<blockquote>
  <p>In the Arduino environment, the standard format-specifier <code>%f or %lf</code>
  is not well-managed and the function <code>dtostrf()</code> is recommended.</p>
</blockquote>

<p>The format is <code>char *   dtostrf (double __val, signed char __width, unsigned char __prec, char *__s)</code> where:</p>

<ul>
<li><code>__val</code> is the floating-point value to be converted,</li>
<li><code>__s</code> is the array of char to store the result,</li>
<li><code>__width</code> is the number of characters to store the result,</li>
<li><code>__prec</code> is the number of digit</li>
</ul>

<p>The conversion is:</p>

<pre><code>char sValueOne[16], sValueTwo[16];
char sBuffer[33];

strcpy(sBuffer,dtostrf(valueOne, 15, 8, sValueOne));
strcat(sBuffer,",");
strcat(sBuffer,dtostrf(valueTwo, 15, 8, sValueTwo));
</code></pre>

<p><strong>Step2</strong> - write the buffer over the <code>BTLEserial</code> object.</p>

<pre><code>BTLEserial.write((uint8_t *)sBuffer, strlen(sBuffer));
</code></pre>

<blockquote>
  <p>Alternate output solution using <code>BTLEserial.print()</code> function.</p>
</blockquote>

<pre><code>BTLEserial.print(sBuffer);
</code></pre>
