transmit data through nRF24L01 only when a certain command is read in serial

Hello,

I am using the SerialCommand library to transmit data only when a specific request is made in the serial monitor. I want to pair this with a wireless communication using two nRF24L01's.

Basically i have an arduino nano and mega. the mega reads sensors inputs, makes an array with them, and sends them wirelessly using the nRF24L01.
I want the arduino nano to receive and update those inputs but only print them to the serial monitor when a specific command is sent to the serial monitor (using SerialCommand).

However, this does not work using the nRF24L01 and I can't figure out why. here is my receiver code.

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

SerialCommand sCmd;

RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00002";

int Array[3];

void setup() { 
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0,address); 
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
sCmd.addCommand("ALL", serialdataPrint );
}

void loop() {
   
   
    if (radio.available()) {
    
    int Array_received[3];
    
    radio.read(&Array_received, sizeof(Array_received));
       
    Array[0] = Array_received[0];
    Array[1] = Array_received[1];
    Array[2] = Array_received[2];
    
   
    }
    
    if (Serial.available()>0){

    
    sCmd.readSerial();
    
    
    }
    
}


void serialdataPrint ()
{
    
    Serial.println(Array[0]);
    Serial.println(Array[1]);
    Serial.println(Array[2]);

}

If I write the command 'ALL' on my monitor, it does not call the function serialdataPrint(). If I remove the serialcommand part i can obviously print the data so I know i am receiving from the nRF. any suggestions?

Thank you!

Try taking int from the start of this line in loop()

    int Array_received[3];

Having int at the start of the line creates a local variable with the same name as your global variable. Just use the global variable.

...R