Quantcast
Channel: MSP430 Technical Forums
Viewing all articles
Browse latest Browse all 2077

Implementing lost signal using ENRF24

$
0
0

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


View the full article on Stellarisiti. 43oh pulls Stellarisiti Energia posts, so that members do not miss out questions. Please bear with this arrangement for now. Thanks!

Viewing all articles
Browse latest Browse all 2077

Trending Articles