rf24 (Multiple TX ) Data Stuc

Im at work and don't have the code on hand but long story short I am sending sensor value in a

struc payload {

int sensor1;
int sensor 2;

}

The RX and and 2 Tx have the same struc.

TX1

struc payload{

int sensor1= sensors.getTempCByIndex(0);
int sensor2;
};

TX2
struc{

int sensor1;
int sensor2=sensors.getTempCByIndex(0);

};

The values are making it to the RX but every other time that it prints one the senor values the other is 0.

My question is how do I keep that from happening or keep Tx from sending a value of 0 for (int sensor 2) and Tx2 from sending a value of zero for (int sensor 1). Or can can each individual TX have its on stuc and the rx have all the struc for both tx's

I have tried a few different ways not a big programmer but learning.

When I get home I do screen shots and send entire exact code and serial monitor. Just thought I would ask

Just a point in the right direction

It looks like in TX1 you set the sensor1 field and in TX2 you set sensor2. It's no surprise then that the untouched field in each struct is zero. Do you really need two structs if you're only sending two values?

danielmdavis1:
Im at work and don't have the code on hand but long story short I am sending sensor value in a

Please post the complete program. The details matter.

I generally create and use structs like this

  // define the struct
struct MySensorDataStruct {
    int sensor1val;
    int sensor 2val;
}

   // create an instance of the struct
MySensorDataStruct mySensorData;

   // store values in the instance
mySensorData.sensor1Val = sensors.getTempCByIndex(0);
mySensorData.sensor2Val = sensors.getTempCByIndex(0);

  // send the struct by nRF24
radio.write(&mySensorData, sizeof(mySensorData));

...R

Well I belive that the reason I used the struct was because of the simplicity of getting the data to the Rx. At least you know far as the reasearch I did. It worked for me but that was the resulting issue. I was under the assumption that the stuct had to be the same on all TX. Im aboout to re do it as you said "Robin2".

The

i just recently did the contraints to keep from storing a zero in the varibale. I mean basically im getting the readings but how can I just store only the non zero values or block the empty value come from one TX or the other.

PS this is based on the FORCETRONICS Sensor NEtwork. I like like it. I just changed it up in the data struc.

serial

T1 = 0.00
T2 = 25.81
T1 = 25.00
T2 = 0.00
T1 = 0.00
T2 = 25.81
T1 = 25.00
T2 = 0.00
T1 = 25.00
T2 = 0.00
T1 = 0.00
T2 = 25.81
T1 = 25.00
T2 = 0.00
T1 = 0.00
T2 = 25.81
T1 = 25.00
T2 = 0.00
T1 = 0.00
T2 = 25.81
T1 = 25.00
T2 = 0.00
T1 = 0.00
T2 = 25.81
T1 = 25.00
T2 = 0.00
T1 = 0.00
T2 = 25.81
T1 = 0.00
T2 = 25.81
T1 = 0.00
T2 = 25.75
T1 = 0.00
T2 = 25.75
T1 = 0

MO.ino (2.1 KB)

L2.ino (2.84 KB)

L1.ino (2.84 KB)

Please include short programs in your post so people don't have to download them. Use the code button </>
codeButton.png

so your code 
looks like this

You seem to have attached 3 different program but you have not described what each does or what are the differences between them.

...R
Simple nRF24L01+ Tutorial