Interrupt Generation using NRF24l01

Hello,

I have connected to buttons at two interrupts available at pin 2 and pin 3 on pro mini at the transmitter side i want to send data to receiver when a button is pressed on transmitter side following is the code for transmitter

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9, 10); // CE, CSN

const byte address[6] = "00001";

int buttonInput = 2;

void setup() {
  radio.begin();
  radio.openWritingPipe(address);
  radio.setPALevel(RF24_PA_MIN);
  radio.stopListening();
  attachInterrupt(0, digitalInterrupt, RISING); //interrupt for waking up
  attachInterrupt(1, digitalInterrupt1, RISING); //interrupt for waking up

}

void loop() {
  
}

void digitalInterrupt()
{
 
  const char text[] = "Hello World";
  radio.write(&text, sizeof(text));
 

}

void digitalInterrupt1()
{
 
  const char text1[] = "Done!!!";
  radio.write(&text1, sizeof(text1));
 

}

And for the Receiver is

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(9, 10); // CE, CSN

const byte address[6] = "00001";

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(0, address);
  radio.setPALevel(RF24_PA_MIN);
  radio.startListening();
}

void loop() {
  if (radio.available()) {
    char text[32] = "";
    radio.read(&text, sizeof(text));
    Serial.println(text);

    
  }

}

The code works only when i press the button on interrupt 1 and transmits data as at the receiver i get

Done!!!

successfully but i cant get “Hello World” when i press button on interrupt 0 .
I also tried to change the button connections even then interrupt 1 only works not the interrupt 0.

What could be the possible reason.

Wiring springs to mind. Can you swap the buttons around & test again.

Also, Interrupt routines are supposed to be short. Set a flag and act on it in loop. Radio.write is not something that should happen there.

I swap the buttons but the result is same and the radio.write do work in interrupt 1 and i am receiving data but i am not receiving from interrupt 0 .

You don't need interrupts to detect buttons that are pressed by a human. Humans are verrryyy slooowwwww. Just poll the switch pins in each iteration of loop().

Have a look at this Simple nRF24L01+ Tutorial

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

...R

Got it the problem was with interrupt pin 0 of the pro mini i changed the pro mini and it started transmitting