Strange behaviour of radio.openWritingPipe with NRF24L01

Whandall:
You are using the wrong datatype for the address,
it is supposed to be 5 bytes, you are supplying only 4.

The fifth byte will be taken from behind the variable, which will probably be different in both cases.

Yes, but the address width is already set to 4 bytes by a call to setAddressWidth(4) and the implementation of openWritingPipe takes care of the address width. See the 2 write_register calls.

void RF24::openWritingPipe(const uint8_t *address)
{
  // Note that AVR 8-bit uC's store this LSB first, and the NRF24L01(+)
  // expects it LSB first too, so we're good.

  write_register(RX_ADDR_P0,address, addr_width);
  write_register(TX_ADDR, address, addr_width);

  //const uint8_t max_payload_size = 32;
  //write_register(RX_PW_P0,rf24_min(payload_size,max_payload_size));
  write_register(RX_PW_P0,payload_size);
}