NRF24L01 AckPayload doesn't work

My problem is that the payload isn’t working

Here is my codes:

RX:

#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>

RF24 radio(9, 8);

const byte rxAddr[6] = "00001";

const char ack = 'a';

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openReadingPipe(0,rxAddr);
  radio.enableAckPayload();
  radio.setRetries(3, 5);
  radio.startListening();
}

void loop() {
  if(radio.available()){
    char message[32] = {0};
    radio.writeAckPayload(1, &ack, sizeof(ack));
    radio.read(&message, sizeof(message));
    Serial.println(message);
    }
}

TX:

#include <nRF24L01.h>
#include <printf.h>
#include <RF24.h>
#include <RF24_config.h>

RF24 radio(8, 10);

const byte rxAddr[6] = "00001";

const char message[] = "Hi";
char ack;

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(rxAddr);
  radio.enableAckPayload();
  radio.setRetries(3, 5);
  radio.stopListening();
}

void loop() {
  delay(1000);
  if(radio.write(&message, sizeof(message))){
    if(radio.isAckPayloadAvailable()){
      radio.read(&ack, sizeof(ack));
      Serial.println(ack);
      }
    }
}

The output I get is

TX: Nothing…

RX:

Hi
Hi
Hi
Hi

Am I doing this correctly? o.o

Have a look at the second example in this Simple nRF24L01+ Tutorial.

...R

Writing acks to pipe 1 and receiving on pipe 0 doesn’t make sense to me.

  radio.openReadingPipe(0,rxAddr);
...
  radio.writeAckPayload(1, &ack, sizeof(ack));

Writing the ack after reception but before retrieval does not magically return the data for this packet,
but will be returned in tha ack of the next packet.

I miss the preloading of the first ack.

Whandall: Writing acks to pipe 1 and receiving on pipe 0 doesn't make sense to me.

  radio.openReadingPipe(0,rxAddr);
...
  radio.writeAckPayload(1, &ack, sizeof(ack));

Writing the ack after reception but before retrieval does not magically return the data for this packet, but will be returned in tha ack of the next packet.

I miss the preloading of the first ack.

Thanks! It worked. Also I changed the order and you were right! :)