counting incoming signal

Hello,

I'm working on a receiver that will read some data (data.id) and uses it to turn on some LED's and buzzers.
The transmitter and receiver are: NRF24L01

struct package                 
{
  int text = 0;
  int id;
};
typedef struct package Package;
Package data;

I use data.text from my transmitter as a counter to my receiver. Each second will count +1.

I want to use this number to check if there are still numbers coming in, on my receiving side. / is my receiver still in range.

Question: How can i check if this data.text still counts and use it to send that signal to my display as a 'RF available' signal.
(When it doesn't count every second anymore, the simbol will dissapear)

NRF24L01_FINAL_Receiver-pcb.ino (8.98 KB)

transmitter_button_adjustment.ino (795 Bytes)

Why is an int called "text"? Also, isn't it possible to get not only status, but also an RSSI from the NRF itself?

Have a look at this Simple nRF24L01+ Tutorial.

The first example includes a value that increments.

If you need more help please post both of your programs (Tx and Rx) and include the code in your Post so we don't have to download it. Please also use the code button </>

...R

aarg:
Why is an int called "text"? Also, isn't it possible to get not only status, but also an RSSI from the NRF itself?

Only one bit. It’s not really much use (other than to say “someone is/isn’t transmitting on this channel)....

If your sender is sending data in a regular pattern ot time for exmaple every 60 seconds
you can use the function millis() to compare time of last receive with actual time
if this period of time exceeds the send-interval the receiver missed a sended message

If the sending pattern is unregular over time:
If you have a counter counting up with each message actual count of new message - 1 = number of last-received message. If difference is bigger than 1 the receiver missed a message

of both devices can send and receive do some handshaking. sender send one message and awaits a acknowledge-messaeg from the receiver

best regards Stefan

Robin2:
Have a look at this Simple nRF24L01+ Tutorial.

The first example includes a value that increments.

If you need more help please post both of your programs (Tx and Rx) and include the code in your Post so we don't have to download it. Please also use the code button </>

...R

Thanks for the tip, i now posted the transmitter as well!

StefanL38:
If your sender is sending data in a regular pattern ot time for exmaple every 60 seconds
you can use the function millis() to compare time of last receive with actual time
if this period of time exceeds the send-interval the receiver missed a sended message

If the sending pattern is unregular over time:
If you have a counter counting up with each message actual count of new message - 1 = number of last-received message. If difference is bigger than 1 the receiver missed a message

of both devices can send and receive do some handshaking. sender send one message and awaits a acknowledge-messaeg from the receiver

best regards Stefan

I am questioning the posibility of the counting because i keep looping through a code that measures a sensor. I don't know if i can aquire a set time for it and use it as timer.
Question two, does the installation of a 'time' cost a lot of memory?
Do you perhaps have any ideas regarding this loop time and clock time? : )

The handshake did look more promising, I will do some research on this, Thanks !

derkpestman:
Thanks for the tip, i now posted the transmitter as well!

You have not included your code in your post as requested.

...R

Here you go...

// Global:
uint32_t last_rx;

//In loop():
  uint32_t now = millis();
  if (now - last_rx >= TIMEOUT)
  {
     // haven't received a message for more than TIMEOUT ms
  }
  if (myRadio.available())
  {
    while (myRadio.available())
    {
      last_rx = now;
      myRadio.read( &data, sizeof(data) );
    }

Unfortunately while the rest of your code is blocking with delays you won't be checking too often for a new message. This limits the minimum value you can choose for TIMEOUT.