Hi All,
I have 2 of these nRF24's transmitting data (float type) to a single receiver. I want to be able to map the data received to the particular sensor. This surely cannot be too hard?
The Transmitter code is as follows - they are the same - even using the same sensor.
#include <SPI.h>
#include "RF24.h"
// (Create an instance of a radio, specifying the CE and CS pins. )
RF24 myRadio(7, 8);
byte addresses[][6] = { "PipeTemp" }; // Create address for 1 pipe.
float tempC;
int reading;
int tempPin = 0;
void setup()
{
//For the LM35 Temperature sensor, use more of the ADC range
analogReference(INTERNAL);
// Use the serial Monitor (Symbol on far right). Set speed to 115200 (Bottom Right)
Serial.begin(115200);
delay(1000);
myRadio.begin(); // Start up the physical nRF24L01 Radio
myRadio.setChannel(108);
myRadio.setPALevel(RF24_PA_MIN);
myRadio.setDataRate(RF24_250KBPS); // Fast enough.. Better range
myRadio.openWritingPipe(addresses[0]); // Use the first entry in array 'addresses'
delay(1000);
}
void loop()
//TempSense
reading = analogRead(tempPin);
tempC = reading / 9.31;
Serial.println(tempC);
myRadio.write(&tempC, sizeof(tempC)); // Transmit the data
//Wireless Tx
Serial.print(F("Data Transmitted = "));
Serial.print(tempC);
Serial.println(F(" No Acknowledge expected"));
delay(500);
}
I have a receiver that grabs the data from 2 sensors, but i can't tell which sensor it came from. There are 6 possible 'pipes', but i can't work out how to differentiate the data between the transmitters. Do i need to send the data in a different pipe? How then do i grab the data from each pipe? The received data is not time critical, it's ok to miss a few packets, but i need to be able to map the data received with the tx that sent it. Has anybody done this?
I'm using this library.
Thanks
S