I am trying to do a 1-1 one-way communication between 2 arduinos using the NRF24L01 module.
On my transmitter side, I have 1 Ultrasonic Sensor and the readings will be sent over to the receiver side.
This is my code for my transmitter side:
unsigned long US1_Measurement = distance;
RF24NetworkHeader header(node01); // (Address where the data is going)
bool ok3 = network.write(header, &US1_Measurement , sizeof(US1_Measurement )); // Send the data
This is my code on my receiver side:
while ( network.available() ) { // Is there any incoming data?
RF24NetworkHeader header;
unsigned long incomingData;
network.read(header, &incomingData, sizeof(incomingData)); // Read the incoming data
Serial.println(incomingData); // Print the sensor readings
}
This is working. Now what I am trying to do now is, on my transmitter side, i want to add an additional ultrasonic sensor. So now i want my transmitter to send both readings from my ultrasonic sensors to the receiver at the same time. I am not sure on how to send both readings at the same time.
Any help would be much appreciated. Thanks