Hello guys. Newbie here. If i want to triggered a buzzer when the receiver didnt get any signal or message from transmitter.i need to setup the code before the rf code or after.? Kindly refer to my attachment. Thank you for your support.

In your receive code, if you don't get a message, I assume that the loop keeps running, and doesn't hang while waiting for traffic. It that is the case, each time you get a message, read millis() and assign it to a variable. Then outside the if{}| construct, check the variable against the current value of millis(), and if it exceeds a selected timeout interval, trigger your buzzer.

Can you show the example. ? I dont understand. Im newbie. Im really sorry. And thanks for your respond.

To do what you are trying to do, u would need 2 transceivers i.e. not just a transmitter and a receiver.

Transmitter End (let's assume a sensor).
Receiver End (let's assume a controller).

The logic would be something like this.

  1. An input to the sensor initiates a message transmission to the controller.
  2. After transmitting, the sensor enters a "wait state" for a set time to receive acknowledgement from the controller that the message was received.
  3. On receiving a message from the sensor, the controller sends an acknowledgement to the sensor that the message was received.
  4. On receiving the acknowledgement, the sensor exits the "wait state" normally and is ready to receive the next input.
  5. If no acknowledgement is received within the "wait state" time limit, the sensor exits the "wait state" abnormally and triggers an alarm, then is ready to receive the next input - or whatever other action u want to program.

Note: The alarm can only be activated by the sensor in this scenario.
If you want the controller to initiate the alarm, the controller must be expecting a message within a given time.