Go Down

Topic: nrf24.send PROBLEM (Read 89 times) previous topic - next topic

sbabakp

Hi,

I write a code and I use NRF24l01 then I need to send info from transmitter to receiver to turn the LED's ON,I'm okay with but there is a problem,transmitter don't send 0 and you its between 0-255 it send the array from 1 - 255
I wanna send 0-255
how can I fix it
its my command for send


==============

        uint8_t Array[4];


        nrf24.send((uint8_t *)&Array, sizeof(Array));

==============

UKHeliBob

Post your complete program
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

sbabakp


UKHeliBob

A picture of you code is useless

Please read this before posting a programming question and follow its advice on how to post or attach code here
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

sbabakp

A picture of you code is useless

Please read this before posting a programming question and follow its advice on how to post or attach code here
Code: [Select]


    if (ledPin == 11)
    {
     if  (val != old_val3)
      {
          Array[2]=map(val, 0, 100, 0, 255);
        nrf24.send((uint8_t*)&Array, sizeof(Array));
      nrf24.waitPacketSent();
      Serial.print("send data TIMER ch3 : ");
      Serial.println(Array[2]);
          old_val3= val;
          final_val3=val;
       }
    }


UKHeliBob

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

sbabakp

Try a simple example like this first

Simple nRF24L01+ 2.4GHz transceiver demo
I did,
and I have no problem with that
but because of some reasons I had to use radiohead library until then I have this problem that I cant send 0 with the bellow code for send

Code: [Select]


nrf24.send((uint8_t*)&Array, sizeof(Array));


UKHeliBob

Your code
Code: [Select]
nrf24.send((uint8_t*)&Array, sizeof(Array));

Robin's code that you say works
Code: [Select]
   rslt = radio.write( &dataToSend, sizeof(dataToSend) );
Why the difference ?

What happens if you send a byte with a value of zero rather than an array ?
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Robin2

I did,
and I have no problem with that
but because of some reasons I had to use radiohead library
Why not use the TMRh20 RF24 library if you have proved to yourself that it works?

I have no experience with the Radiohead library.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up