I want to send the raw data from DHT22 and DS18B20 with nRF24l01+.
The issue is: if there is a 0x00 data in my payload, the data from the 0x00 and the following are not received by the second nRF24L01+. If the payload contains values different of 0x00, i receive all the 10 datas. If, for example, the data of byte 2 is 0x00, the data from byte 2 to 9 are not received.
I use the tmrh20 library.
In the printfDetails of the receiver, all is OK as configured (and not in dynamic payload).
Is it a problem of configuration OR the nRF24L01+ manage the data in this way and i have to manage the 0x00 data ?
Thanks !
Receiver board (part of program:)
RF24 radio(8, 9);
const uint64_t TxArrosage = 0x1111111111; //adresse pipe: p38/75 datasheet nRF24L01+
const uint64_t RxArrosage = 0x2222222222;
const int payloadnRF = 10;
const uint8_t AddressWidth = 3; //nbre d'octets pour adresse
byte nRFBuffer[payloadnRF];
setup:
....
radio.begin();
radio.setPALevel(RF24_PA_LOW);
radio.setDataRate(RF24_250KBPS); //!!setting RF24_250KBPS will fail for non-plus units
radio.setPayloadSize(payloadnRF);
radio.setAddressWidth(AddressWidth);
radio.openWritingPipe(TxArrosage); //emission sur pipe0
radio.openReadingPipe(1,RxArrosage);
radio.startListening();
....
loop:
....
while ( radio.available() ){
// while ( radio.available(1) ){
Serial.println("payload size");
uint8_t payloadSize = radio.getPayloadSize();
Serial.println(payloadSize);
radio.printDetails();
Serial.println("Paquet nRF reçu");
radio.read(nRFBuffer,payloadnRF);
//Serial.println((char *)nRFBuffer);
for (byte i=0; i<10; i++){Serial.print(nRFBuffer[i]);}
.....
You have right, i wrote the following code and i can send/receive the 0x00 data.
I just have to find the problem in my previous code that I was thinking simple.
Thanks
void setup(void)
{
Serial.begin(115200);
Serial.println("Emetteur de donnees");
radio.begin();
radio.setPALevel(RF24_PA_LOW);
radio.setDataRate(RF24_250KBPS); //!!setting RF24_250KBPS will fail for non-plus units
radio.setPayloadSize(payloadnRF);
radio.setAddressWidth(AddressWidth);
radio.openWritingPipe(TxArrosage); //emission sur pipe0
radio.openReadingPipe(1,RxArrosage);
Serial.println("Fin setup");
}
void loop(void)
{
radio.startListening();
while ( radio.available()){
Serial.println("Reçu");
radio.read(nRFBuffer,payloadnRF);
for (byte i=0; i<10; i++){Serial.print(nRFBuffer*);Serial.print(',');}*
To make it easy for people to help you please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. See How to use the Forum
Your code is too long for me to study quickly without copying to a text editor.
Also use the AutoFormat tool to indent your code for easier reading.
And I am confused ...
Is the code in Reply #2 the working code?
If it works, why bother with the earlier version?
If you do want to figure out what is wrong with the earlier version then compare them carefully