I would like to know if it is possible to wake up the Arduino (in this case Nano or One) when it receives a signal by the transceiver. And if it is possible what code could I use?
Currently I have built a code so that, if the receiver does not receive a signal in 10 seconds, it falls asleep. However, I can not find a code to wake him up when he receives a signal again.
To sleep the Arduino I use the libraries <avr / power.h> and <avr / sleep.h> with the void that I will place next.
set_sleep_mode(SLEEP_MODE_PWR_SAVE); // sleep mode is set here
sleep_enable(); // enables the sleep bit in the mcucr register
// so sleep is possible. just a safety pin
sleep_mode(); // here the device is actually put to sleep!!
// THE PROGRAM CONTINUES FROM HERE AFTER WAKING UP
sleep_disable(); // first thing after waking from sleep:
// disable sleep…
This is the conditional code with which I manage to make him fall asleep rather than wake him up. If anyone knows any way to wake him up as soon as he receives a signal from NRF24L01, I would be very grateful if he would share it with me.
count = 0;
int done = radio.read(msgR, 16);
radio.stopListening(); // We stop listening to send an answer
if (count >= 10)
Serial.println(“Entering sleep mode”);
count = 0;