user25779: I'd like the double number 200.00 shown as 200.00 on my LCD screen.
For instance, when I pass just a number (int) like 40 to the LCD, it uses it as an ASCII code to show a character on the display. 
Now I want to send a double to it and it should be displayed as a double.
#include <Wire.h>

void setup() {
   Wire.begin(0x63);
}


double f;
void loop() {

  f = 200.00;

  Wire.beginTransmission(0x63);
  Wire.write(byte(0x00));
  Wire.write(4); //HIDE CURSOR
  Wire.write(12); //CLEAR SCREEN
  Wire.write(13); //CURSOR 2nd LINE
  Wire.write("Frequenz: ");
  Wire.write(f); //<- How to do this?
  Wire.write("Hz");
  Wire.endTransmission();
}


user7508: Use Wire.print(), instead of Wire.write() which is intended only to output single bytes or byte arrays.

user13432: The Arduino Wire class does only support write() of byte, string and vector of bytes. To write a double it must first be converted to a string. This can be done with the standard C library function dtostrf().
double f;

void loop() {
  char buf[10];

  f = 200.00;

  Wire.beginTransmission(0x63);
  Wire.write(byte(0x00));
  Wire.write(4); //HIDE CURSOR
  Wire.write(12); //CLEAR SCREEN
  Wire.write(13); //CURSOR 2nd LINE
  Wire.write("Frequenz: ");
  Wire.write(dtostrf(f, 0, 2, buf));
  Wire.write("Hz");
  Wire.endTransmission();
}

The class inherits from Print (via Stream) so that the overloaded member function print() for double can be used. In that case: 
double f;

void loop() {
  f = 200.00;

  Wire.beginTransmission(0x63);
  Wire.write(byte(0x00));
  Wire.write(4); //HIDE CURSOR
  Wire.write(12); //CLEAR SCREEN
  Wire.write(13); //CURSOR 2nd LINE
  Wire.write("Frequenz: ");
  Wire.print(f);
  Wire.write("Hz");
  Wire.endTransmission();
}

Please note that the maximum number of bytes to write (between beginTransmission and endTransmission) is limited to 32 in the standard configuration of the Arduino core. 
Cheers!

25779: <p>I'd like the double number 200.00 shown as <code>200.00</code> on my LCD screen.</p>

<p>For instance, when I pass just a number (<code>int</code>) like 40 to the LCD, it uses it as an ASCII code to show a character on the display. </p>

<p>Now I want to send a <code>double</code> to it and it should be displayed as a double.</p>

<pre><code>#include &lt;Wire.h&gt;

void setup() {
   Wire.begin(0x63);
}


double f;
void loop() {

  f = 200.00;

  Wire.beginTransmission(0x63);
  Wire.write(byte(0x00));
  Wire.write(4); //HIDE CURSOR
  Wire.write(12); //CLEAR SCREEN
  Wire.write(13); //CURSOR 2nd LINE
  Wire.write("Frequenz: ");
  Wire.write(f); //&lt;- How to do this?
  Wire.write("Hz");
  Wire.endTransmission();
}
</code></pre>
 7508: <p>Use <code>Wire.print()</code>, instead of <code>Wire.write()</code> which is intended only to output single bytes or byte arrays.</p>
 13432: <p>The Arduino <a href="https://www.arduino.cc/en/Reference/Wire" rel="nofollow">Wire</a> class does only support <a href="https://www.arduino.cc/en/Reference/WireWrite" rel="nofollow">write()</a> of byte, string and vector of bytes. To write a double it must first be converted to a string. This can be done with the standard C library function <a href="http://www.atmel.com/webdoc/AVRLibcReferenceManual/group__avr__stdlib_1ga060c998e77fb5fc0d3168b3ce8771d42.html" rel="nofollow">dtostrf()</a>.</p>

<pre><code>double f;

void loop() {
  char buf[10];

  f = 200.00;

  Wire.beginTransmission(0x63);
  Wire.write(byte(0x00));
  Wire.write(4); //HIDE CURSOR
  Wire.write(12); //CLEAR SCREEN
  Wire.write(13); //CURSOR 2nd LINE
  Wire.write("Frequenz: ");
  Wire.write(dtostrf(f, 0, 2, buf));
  Wire.write("Hz");
  Wire.endTransmission();
}
</code></pre>

<p>The class inherits from <a href="https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Print.h" rel="nofollow">Print</a> (via <a href="https://www.arduino.cc/en/Reference/Stream" rel="nofollow">Stream</a>) so that the overloaded member function <a href="https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/Print.h#L67" rel="nofollow">print()</a> for double can be used. In that case: </p>

<pre><code>double f;

void loop() {
  f = 200.00;

  Wire.beginTransmission(0x63);
  Wire.write(byte(0x00));
  Wire.write(4); //HIDE CURSOR
  Wire.write(12); //CLEAR SCREEN
  Wire.write(13); //CURSOR 2nd LINE
  Wire.write("Frequenz: ");
  Wire.print(f);
  Wire.write("Hz");
  Wire.endTransmission();
}
</code></pre>

<p>Please note that the maximum number of bytes to write (between beginTransmission and endTransmission) is <a href="https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/libraries/Wire/src/Wire.h#L28" rel="nofollow">limited to 32</a> in the standard configuration of the Arduino core. </p>

<p>Cheers!</p>
