zeitgeist87 / RFReceiver

An Arduino library for low-cost 433 MHz receiver modules with a focus on reliable one-way communication and forward error correction
GNU General Public License v3.0
57 stars 12 forks source link

stopping the searching of new messages #9

Open MassiStr opened 4 years ago

MassiStr commented 4 years ago

Hi, nice work! I have a problem: how can I stop searching for a new message from the transmitter, and go on with the sketch, for example because the transmitter is now offline and i have other sensors to check after? for example, in VirtualWire I have the command "vW wait ()"..Thanks!!

zeitgeist87 commented 4 years ago

Hi @MassiStr,

The receiver has a method called ready(). If ready() returns true, then a subsequent call to recvPackage() won't block. So the code would look like this:

if (receiver.ready()) {
    receiver.recvPackage(...);
    // Do something with the data
} else {
    // Check your other sensors
}

Regards, Andreas

MassiStr commented 4 years ago

Hi zeitgeist87, THANKS, It works perfectly! I found your library very useful, It works even with the new Arduino Nano Every (Atmega4809), the VirtualWire/RadioHead did not works.

Regards, Massimo