Auto connecting nrf24l01

I have a project I am working hard on here. The project needs to be able to auto detect a module it can communicate with if it is in range. It seemed simple when I started but I am getting nowhere. Any ideas? This is what I tried.

void updateWifiAddresses()
{
  radio.stopListening();
  uint64_t x = 0x00000000LL;
  radio.openReadingPipe(1,x);
  radio.startListening();
  
  bool found = false;
           
  do
  {
     if(radio.available(0))
    {
      s0Address = x;
      Serial.println("SUCCESS!!!!");
      found = true;
    }
    else
    {
      Serial.println("Failure");
      x++;
      radio.stopListening();
      radio.openReadingPipe(1,x);
      radio.startListening();
    }
  }while (x < 0x000000FFLL && !found);
}

So my project works if the master has the slave address pre coded just fine.
The address of the slave is = 0x 00000005 LL

on a second note does anyone know why you are only able to use 255 addresses with these modules? The addresses have to match each other on the first three bytes of the uint64 address with the last byte able to be unique. Thats a large variable for using so little of it.

My first question is why is the function named updateWifiAddresses() when an nRF24 has nothing to do with WiFi?

It would help if you describe the project. How many possible modules do you wish to have?

What sort of range have you in mind? I have had a pair working successfully at 110 metres.

Could the master cycle through a list of addresses expecting to get a response from any that are in range.

Could the slaves know the address of the master and be designed to send a "Here I am" message whenever they are powered up?

...R

csheffield90: on a second note does anyone know why you are only able to use 255 addresses with these modules? The addresses have to match each other on the first three bytes of the uint64 address with the last byte able to be unique.

You can use 5 byte addresses without a problem.

You will run into problems with a prefix of 0x00000000, 0xFFFFFFFF, or anything that has too less level changes in it.

Read and try to understand the datasheet.