monitor if rf module is still transmitting

Hi all. I'm looking for some help to know where to look for.

Short summary of my project. I have an arduino with RF module transmitting the characters 1, 2 or 3 to another arduino with the receiving RF module.

If character 1 is recieved one led will light up, if character 2 is received no led will light up and if character 3 is received another led will light up.

My transmitter part is running on a battery charged by solar. Now i would like to have some code checking if there is a signal being send by the transmitter. So basically looking if my transmitter is stil alive sending me the characters. These will be send ever second or so.

Can anybody point me in the right direction to what kind of code i need to look for? Please keep in mind i'm fairly new to the coding part of arduino's so please be gentle if i ask a stupid question :wink:

Thanks for your help in advance and if more information is needed please let me know.

If you are content for the transmitter to be working all the time (and using energy) then a simple solution is to get it to transmit at regular intervals - perhaps every second or so - and then if the receiver does not receive a character after a certain amount of time it knows that there is a transmission failure.

For a very simple system you could try something like this pseudo code on the receiver

if character is received {
   latestCharacterMillis = millis()
}

if (millis() - latestCharacterMillis >= interval) {
   // there has been no character for interval millis
}

...R

Robin2 Thank you. I'll be looking into this.

I got it working thanks a lot for helping me out here. Such a easy thing but just so hard if you just don't really know what to look at :slight_smile:

Bringamosa:
I got it working thanks a lot for helping me out here. Such a easy thing but just so hard if you just don't really know what to look at :slight_smile:

Are you able to confirm what you did to make it work ?

I used the code Robin2 suggested me to use :slight_smile:

Probably not relevant but here is what i did:

  if (driver.recv(buf, &buflen)) // if message received, save it
  
{
   laatstDataOntvangen = millis();
}

if (millis() - laatstDataOntvangen >= 10000) // aantal ms voordat hij geen ontvangst weergeeft
{
  digitalWrite(LEDLEEG, HIGH);
  digitalWrite(LEDVOL, HIGH);
  Serial.println("geen ontvangst");
}