Can't make simple 2-way nrf24l01 code to work. Examples work fine, so shouldn't be a hardware issue

Tried boiling down the tutorial example codes to make it as straight-forward as possible, but it just ain't doing anything.

*The main difference between the receiver and transmitter is write and read parts have switched places in the loop and adds different numbers.

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

RF24 radio(7, 8); // CE, CSN
const byte addresses[][6] = {"00001", "00002"};
float valueTransmit;
float valueRecieved;

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(addresses[1]); // 00002
  radio.openReadingPipe(1, addresses[0]); // 00001
  radio.setPALevel(RF24_PA_LOW);
  valueTransmit = 0;
}
void loop() {
  radio.stopListening();
  radio.write(&valueTransmit, sizeof(valueTransmit));
  delay(5);

  radio.startListening();
  if (radio.available() ) {
      radio.read( &valueRecieved, sizeof(valueRecieved) );
      Serial.print(valueRecieved);
      valueTransmit = valueRecieved + 0.01;
  }
}




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

RF24 radio(7, 8); // CE, CSN
const byte addresses[][6] = {"00001", "00002"};
float valueTransmit;
float valueRecieved;

void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(addresses[0]); // 00001
  radio.openReadingPipe(1, addresses[1]); // 00002
  radio.setPALevel(RF24_PA_LOW);
}
void loop() {
  radio.startListening();
  if (radio.available() ) {
    radio.read( &valueRecieved, sizeof(valueRecieved) );
    Serial.print(valueRecieved);
    valueTransmit = valueRecieved + 1;
  }
  
  radio.stopListening();
  radio.write(&valueTransmit, sizeof(valueTransmit));
  delay(5);

}

My thought was that they're just way out of sync and when one is writing the other isn't necessarily listening. So I tried adding while (radio.available()) {} loops for it to wait before reading, but that just makes it freeze.

Any other reasons? Did I make the code too simple?

May I suggest Robin2's simple rf24 tutorial. It helped me to get my radios to work. There is a part that covers shifting roles and example code.

Pay attention to the part about powering the radios. Probably the number one issue is insufficient power.

2 way comm also can be established with a master/slave setup using the ack payload. That is the way that I used them.

That's what I used to check if the hardware is fine and it works. So there shouldn't be any power issues.

Is the ack payload required, when doing 2-way comm? Otherwise it would be hard to add that to this code, since it isn't working on it's own.

The actual ICs doing the communication require an ACK to ensure the transmission was received. Adding data to the return ACK message is just icing on the cake!
Paul

Can you explain what you want to do ?

The normal case is that there is one part which is defined as the transmitter.
There is another part defined as the receiver.
The receiver part is always ready and listening for signals from the transmitter part.
The NRF24L01 protocol handles packet acknowledgement (ack) re transmission requests, Integrity checks (CRC) etc.

You appear to have mixed transmitting and receiving and ask about "ack".

If you have requirements which differ from the normal case, for example 2 way communication, state what they are.

Right after the section on the ack payload there is the section and code for the Two-way transmission by swapping roles. Isn't that what you are trying to do.

@6v6gt sorry if not clear. I want to send an initial value (0) from transmitter, then the receiver adds +1 and sends it back, then transmitter adds +0.01 and sends back and so on and so on. Preferably without any extra overhead like data ack, for now.

@groundFungus yes, I also had tried to edit it to my liking (emphasis on tried). So instead of messages it just sends integers and counts them up, but that also didn't work. Saved a little edit where I show what I had changed. Not like I changed anything critical, right? Just changed the type of data sent.
*Mostly just changed the data from arrays to integers and in the update cycle did so it counts up those integers.

So decided to try make an even more bare-bones version of that.

Eh, realised I've bitten off more than I can chew anyways. Remade my project so one-way communication would be enough - just wanted it to be a bit extra.
But it would still be interesting to know why this didn't work, if anyone has a clue.