Question about ACK with payload in NRF24L01

Hello, I've read some tutorials about ACK feature in NRF24, there are using TMRh20 version of the RF24 Library. These two tutorials that I want to get:

arduino-nrf24l01-communications

Topic: Simple nRF24L01+ 2.4GHz transceiver demo

Both calls ACK with payload with little different of code, but I still don't understand code of ACK with payload part

Any someone knows and explain to using ACK with payload?
Thank You!

totagsayogya:
Any someone knows and explain to using ACK with payload?

Yes. The NRF24L01+ datasheet.

Hello Whandall, thank you for sending link of the datasheet.

But, I still don’t understand in this tutorial, Topic: Simple nRF24L01+ 2.4GHz transceiver demo

int ackData[2] = {109, -4000}; // the two values to be sent to the master
void updateReplyData() {
    ackData[0] -= 1;
    ackData[1] -= 1;
    if (ackData[0] < 100) {
        ackData[0] = 109;
    }
    if (ackData[1] < -4009) {
        ackData[1] = -4000;
    }
    radio.writeAckPayload(1, &ackData, sizeof(ackData)); // load the payload for the next time
}

and this arduino-nrf24l01-communications

// simple integer array for data from each slave node: { node_id, returned_count }
int remoteNodeData[3][3] = {{1, 1,}, {2, 1}, {3, 1}};
// increment node count - reset to 1 if exceeds 500
  if (remoteNodeData[NODE_ID][1] < 500) {
    remoteNodeData[NODE_ID][1]++;
  } else {
    remoteNodeData[NODE_ID][1] = 1;
  }

  // set the ack payload ready for next request from the master device
  radio.writeAckPayload(1, &remoteNodeData[NODE_ID], sizeof(remoteNodeData[NODE_ID]));
}

Both are in RX node. Do you know those array means?

AckPayload is a payload attached to the Ack that can handshake a communication.

What data is sent is up to the programmer, just like for normal sends.

It's all in the datasheet, read it until you understand.

totagsayogya:
But, I still don't understand in this tutorial, Topic: Simple nRF24L01+ 2.4GHz transceiver demo

You have not explained what it is that you don't understand.

The idea of ack-payload seems simple to me. Some data is sent by the Arduino to the nRF24 so that the nRF24 has it available to send as part of the acknowledgement of the next message it receives.

Think of it like having a packet of sweets on the table inside the front door so you can immediately hand it out when some kids call with "trick-or-treat".

...R

The part of I don't understand is the function of those array in my upper comment. What it function? And if Data is successfully send, are ACK payload still send?

This array

int ackData[2] = {109, -4000}; // the two values to be sent to the master

contains the data that will form the AckPayload.

This line

radio.writeAckPayload(1, &ackData, sizeof(ackData)); // load the payload for the next time

sends whatever is in the array to the nRF24 so that it is available to be sent when the nRF24 receives the next message.

In normal operation when an nRF24 receives a message it automatically sends an acknowledgement - that process is used in the first example in my Tutorial. The AckPayload feature (as illustrated in my second example) extends that capability by enabling you to get the nRF24 to send your data as part of the acknowledgement. Doing that means that you (as programmer) don’t have to bother with the complexities of getting both Arduinos to switch between talking and listening.

…R