Go Down

Topic: Signal loss NRF24L01 transmitter, code for receiver response code. (Read 98 times) previous topic - next topic

Chillpollins

Hi,

I would like an output to occur in my receiver if the signal is discontinued from the transmitter. Not sure how to do this.

Paul_KD7HB

Hi,

I would like an output to occur in my receiver if the signal is discontinued from the transmitter. Not sure how to do this.
You probably have a lot more information about your problem than we do. So, how do you expect any help?

Paul

Chillpollins

A reference to any existing thread with related or similar issue would get me going, I sure there is one here on these boards, just haven't found it yet. Still looking... Here is for my receiver.

#include <SPI.h>
#include <nRF24L01.h>

#include <RF24.h>


RF24 radio(7,8);
long a;
const byte address[6] = "00001";


void setup() {
 Serial.begin(9600);
 radio.begin();
 radio.openReadingPipe(0, address);
 radio.setPALevel(RF24_PA_MIN);
 radio.startListening();
 pinMode(2, OUTPUT);
 pinMode(3, OUTPUT);

digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
}



void loop() {
  if (radio.available()){
 
    radio.read(&a, sizeof(a));
    Serial.println(a);
   



   if(a < 3){

     digitalWrite(2, HIGH);
     digitalWrite(3, HIGH);
   }
   
   if (a >16){
   digitalWrite(2, LOW);
   }
 
   if (a >18){
   digitalWrite(2, LOW);
   digitalWrite(3, LOW);
   }
  }
   

  }

Pepeillo

You can use a timed counter os something like that
Check the STATUS register ando look for RX_DR flag. If flag is true then you increment the counter.
Every X time check the counter. If its '0' then the RX is receiving nothing.

Robin2

The simplest solution is for the Tx to send a message at regular intervals (say 5 times per second) even if the data does not change. If the Rx does not get a message within (say) 1 second (i.e. 5 missed messages) it can take action.

I use this system for radio control with model trains.

...R
Simple nRF24L01+ Tutorial
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up