title: Sending decimals using radio.write(); with Arduino
body: <p>I'm adapting a sketch I found to send sensor data over a wifi chip (Nrf2401), and although I get the message through, the value I send contains decimals (e.g. 24.59), but the received message will only be 24.</p>
  
  <p>I'm sure there's something wrong on the transmitter part of the code, but I can't see what.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>#include &lt;RF24.h&gt;
  #include &lt;RF24_config.h&gt;
  #include &lt;SPI.h&gt;
  #include &lt;OneWire.h&gt;
  #include &lt;DallasTemperature.h&gt;
  
  OneWire oneWire(4);
  
  DallasTemperature sensors(&amp;oneWire);
  
  // ce,csn pins
  RF24 radio(8,7);
  
  unsigned char data[3] = {
    0};
  unsigned long count=0;
  void setup(void)
  {
    sensors.begin();  
    Serial.begin(57600);
    Serial.println("**************V1 Send Sensor Data***********");
    radio.begin();
    radio.setPALevel(RF24_PA_LOW);
    radio.setChannel(0x4c);
  
    // open pipe for writing
    radio.openWritingPipe(0xF0F0F0F0E1LL);
  
    radio.enableDynamicPayloads();
    radio.setAutoAck(true);
    radio.powerUp();
    Serial.println("...Sending");
  }
  
  void loop(void)
  {
    sensors.requestTemperatures();
    float currentTemp;
    currentTemp = sensors.getTempCByIndex(0);
  
    //assign 'T' to represent a Temperature reading
    data[0] = 'T';
    data[1] = currentTemp;
    count++;
    // print and increment the counter
    radio.write(data, sizeof(float)+1);
    Serial.print("Temperature sent:  ");
    Serial.println(currentTemp);
    // pause a second
    delay(500);
  }
  </code></pre>
  
  <p>In this example, when I print currentTemp, it will display the decimals, but if I print data[1], it won't. </p>
  
  <p>What am I missing?</p>