Jump to content
43oh

Implementing lost signal using ENRF24


Recommended Posts

Hi guys,

 

does someone know of a way to implement "lost signal" on the reciever side with Spirilis's ENRF24 library? 

 

I tried using rfSignalDetected() it seems to always evaluate to true. Because the while(!radio.available()) always just sits waiting until the data is ready I can't seem to think of a way to check if I stopped recieving data.

 

Something like:

void loop () {
  unsigned long lastRecvTime = 0;
  while(!radio.available()) 
  ;
  if(radio.read(&data, sizeof(MyData))){
    lastRecvTime = milis();
  }
  
  unsigned long now = millis();
  
  if( now - lastRecvTime > 1000) {
    //signal lost
  }
}

doesn't really work, because I jsut wait in the while loop and that means I dont do anything until data is ready.

 

 

Thanks

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...