O I realized that I have push a naive version to see the obvious issue. Do not pay attention to comment since they don't match at all to what the code is doing.
// **** INCLUDES *****
#include "LowPower.h"
#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>
#define LOGDEBUG 0
//DEBUG
#if LOGDEBUG==1
#define DEBUG_PRINT(x) Serial.print(x)
#define DEBUG_PRINTDEC(x) Serial.print(x, DEC)
#define DEBUG_PRINTLN(x) Serial.println(x)
#define DEBUG_RADIO() radio.printDetails()
#else
#define DEBUG_PRINT(x)
#define DEBUG_PRINTDEC(x)
#define DEBUG_PRINTLN(x)
#define DEBUG_RADIO()
#endif
/***********************************/
RF24 radio(7,8);
#define LED_PIN 13
#define RF24_CH 25
#define SLEEP_TIME 75
byte addresses[][6] = {"1Node","2Node"};
/***********************************/
const int interruptPin = 3;
volatile int numChangeInterrupt = 0;
void radioSetup(){
radio.begin();
radio.setChannel(RF24_CH);
radio.setDataRate(RF24_250KBPS);
radio.setPALevel(RF24_PA_MAX);
radio.setCRCLength(RF24_CRC_16);
radio.setRetries(15, 5);
radio.setAutoAck(1);
radio.openWritingPipe(addresses[0]);
radio.openReadingPipe(1,addresses[1]);
DEBUG_RADIO();
DEBUG_PRINTLN("Radio up");
delay(100);
}
void resetRadio()
{
delay(250);
radio.flush_tx();
delay(50);
radio.powerDown();
radio.end();
delay(100);
DEBUG_PRINTLN("Radio down");
}
void blinkLed(int num)
{
DEBUG_PRINT("Blink");
DEBUG_PRINTLN(num);
pinMode(LED_PIN, OUTPUT);
for (int i =0; i<num; i++)
{
digitalWrite(LED_PIN,HIGH);
delay(500);
digitalWrite(LED_PIN,LOW);
delay(500);
}
}
void Interrupt() {
DEBUG_PRINT("Pulse.");
numChangeInterrupt = numChangeInterrupt+1;
}
void setup()
{
delay(500);
#if LOGDEBUG==1
Serial.begin(9600);
printf_begin();
#endif
blinkLed(2);
// Configure wake up pin as input.
// This will consumes few uA of current.
pinMode(interruptPin, INPUT);
attachInterrupt(digitalPinToInterrupt(interruptPin), Interrupt, RISING);
}
void loop()
{
unsigned int sleepCounter = SLEEP_TIME;
for (; sleepCounter > 0; sleepCounter--)
{
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
}
noInterrupts();
int numChange = numChangeInterrupt;
interrupts();
bool isWriteOk = false;
int numTry = 0;
while ( !isWriteOk && numTry++ < 5 )
{
radioSetup();
isWriteOk = radio.write( &numChange, sizeof(int) );
resetRadio();
}
blinkLed(isWriteOk ? 2 : 1);
}