Sign up ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

It's about the RF24 library you can find here. http://maniacbug.github.io/RF24/index.html

I transmit data from one Arduino to another using NRF24L01 radios. When I use the write-function on the transmitter arduino (joystick is an array) and after that I put in a delay higher then 10, the available function returns false.

Transmitter

radio.write( joystick, sizeof(joystick) );
delay(20);

Receiver

if(!available())
  print('No data'); // delay > 10 --> No data will be printed

Why is it working with a delay of 10 but not above? Has it something to do with timeouts which is mentioned in the docs of the library?: http://maniacbug.github.io/RF24/classRF24.html#a4cd4c198a47704db20b6b5cf0731cd58

Thank you for your answers.

share|improve this question
    
Don't you check repeatedly to see if data becomes available later? Unless you use an interrupt from the radio to the processor, you will need to. –  Chris Stratton Jan 21 at 1:20
    
I check repeatedly in the sense of the standard loop. What I think is, that Arduino prints a huge amount of "No data" because of the delay. When delay is over, one single line is different, then again a huge amount of "No data" lines. I was scrolling the Serial Monitor, but this was not the case. Or maybe I scrolled not long enough? Would be interesting how many milliseconds a small loop needs to complete...But I think it's just better when I use: while(!radio.available()) {} so that only something happens when there is a payload. I will try this today. –  mathnow Jan 21 at 3:11
    
Yes, it's not usually useful to repeatedly log that data is not available, thiugh if you are really curious you could count the number of loops until data is obtained and print that with the data. –  Chris Stratton Jan 21 at 3:38
    
Nice, that's a great idea. Yes, I'm very curious about this. I will share the result after I tried. –  mathnow Jan 21 at 3:53
    
I consider that if statement without brackets kinda risky since it's harder to read than brackets. Apparently there's more code here; can you add that so we can see if there's another issue? I like that you tried to make it smaller, but can you please include an example with enough to compile? Thanks! (On a side note, what's this joystick variable? A class?) –  Annonomus Penguin Jan 22 at 14:16

2 Answers 2

Please read this: Arduino NRF24L01+ arduino to netmf transmit issue
Although you are not using NETMF, @PhilVallone uses the library and chip together successfully, points out the samples are not asynchronous, and addresses time-out. The OP for that question is using delay(1000) and no answer has been accepted.

share|improve this answer
    
I don't believe there is any use of interrupts or threading involved, making this mostly irrelevant. Do you have evidence otherwise? –  Chris Stratton Feb 7 at 19:48
    
Answers should have some relevance to the problem - random unrelated suggestions do not. –  Chris Stratton Feb 7 at 20:25
    
And what bootloader bugs do you think might be relevant? Do you realize how self contained the code in question is? This is not helpful, it's an uninformed grasping at straws. –  Chris Stratton Feb 7 at 21:21
    
Please take some time to actually read the code associated with the question... –  Chris Stratton Feb 7 at 21:35
    
With your feedback, I have backtracked and await the OP's reply. –  Jon Feb 7 at 22:07

Try updating your library to the new TMRh20 fork. That improves the old maniacbug's version a lot.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.