user131: I'm building a weather station with two UNOs, using NRF24l01+ radios. Communications are fine. I'm sending a struct from one to the other. The struct has three elements:
    struct weather {
      float tempData;
      float humData;
      float pressData;
    };
    weather wData = {0, 0, 0};

I then populate the struct with values from my DHT22 Temperature Sensor and my BMP085 pressure sensor.
    float c = dht.readTemperature();
    wData.tempData = (c * 9/5) + 32;
    wData.humData = dht.readHumidity();

    sensors_event_t event;
    bmp.getEvent(&event);
    wData.pressData = (0.0295 * event.pressure);

Now I send it via the NRF24L01+.
    radio.write(&wData, sizeof(wData);

On the receiving Uno I have this.
    struct weather {
      float tempData;
      float humData;
      float pressData;
    };

    weather wData = {0, 0, 0};

    radio.read( &wData, sizeof(wData) );
    Serial.println(wData.tempData);
    Serial.println(wData.humData);
    Serial.println(wData.pressData);

I get results similar to this:
    Temp = 75.43
    Hum = 35.76
    Press = 0.00

The first two are correct. The final one is not. I can change the order and the first two will always be correct, but the last element is always 0.00. For example:
   Hum = 35.76
   Press = 30.14
   Temp = 0.00

I know I'm missing something here with my code but I can't find it. Anyone have some suggestions?

user131: Modified my struct by changing the first two elements from float to int.
struct weather {
  int tempData;
  int humData;
  float pressData;
}
weather wData;

Everything transmits fine now. I don't really need the precision of a float for temperature and humidity. However, I would still like to find the problem. Could there be some problem with the size of three floats versus two ints and a float? Serial.print(sizeof(wData)) is 12 when all elements are floats and 8 when using two int and a float. My understanding is the NRF24L01+ has a transmit and receive buffer of 32 bytes.

131: <p>I'm building a weather station with two UNOs, using NRF24l01+ radios. Communications are fine. I'm sending a struct from one to the other. The struct has three elements:</p>

<pre><code>    struct weather {
      float tempData;
      float humData;
      float pressData;
    };
    weather wData = {0, 0, 0};
</code></pre>

<p>I then populate the struct with values from my DHT22 Temperature Sensor and my BMP085 pressure sensor.</p>

<pre><code>    float c = dht.readTemperature();
    wData.tempData = (c * 9/5) + 32;
    wData.humData = dht.readHumidity();

    sensors_event_t event;
    bmp.getEvent(&amp;event);
    wData.pressData = (0.0295 * event.pressure);
</code></pre>

<p>Now I send it via the NRF24L01+.</p>

<pre><code>    radio.write(&amp;wData, sizeof(wData);
</code></pre>

<p>On the receiving Uno I have this.</p>

<pre><code>    struct weather {
      float tempData;
      float humData;
      float pressData;
    };

    weather wData = {0, 0, 0};

    radio.read( &amp;wData, sizeof(wData) );
    Serial.println(wData.tempData);
    Serial.println(wData.humData);
    Serial.println(wData.pressData);
</code></pre>

<p>I get results similar to this:</p>

<pre><code>    Temp = 75.43
    Hum = 35.76
    Press = 0.00
</code></pre>

<p>The first two are correct. The final one is not. I can change the order and the first two will always be correct, but the last element is always 0.00. For example:</p>

<pre><code>   Hum = 35.76
   Press = 30.14
   Temp = 0.00
</code></pre>

<p>I know I'm missing something here with my code but I can't find it. Anyone have some suggestions?</p>
 131: <p>Modified my <code>struct</code> by changing the first two elements from <code>float</code> to <code>int</code>.</p>

<pre><code>struct weather {
  int tempData;
  int humData;
  float pressData;
}
weather wData;
</code></pre>

<p><strong>Everything transmits fine now.</strong> I don't really need the precision of a <code>float</code> for temperature and humidity. However, I would still like to find the problem. Could there be some problem with the size of three <code>floats</code> versus two <code>ints</code> and a <code>float</code>? <code>Serial.print(sizeof(wData))</code> is <code>12</code> when all elements are <code>floats</code> and <code>8</code> when using two <code>int</code> and a <code>float</code>. My understanding is the NRF24L01+ has a transmit and receive buffer of 32 bytes.</p>
