Im currently working on creating an FHSS code for NRF24L01 modules which have this function that you can change the channel. I have the following TX code:
Then you should do your homework/project/whatever.
You will learn much less if somebody tells you how it can be done.
And even here (where people sometimes solve alien problems just for fun),
you will have a much better response if your code shows that you tried to solve the problem.
Adding an basically unused array does not count IMHO.
I was just asking for sugestions.I tried using autoAck function from RF24 library to change the channel when the ack is recieved but i never receive an ack.
OK. As has been pointed out, you should not get a ready made answer.
However, just to get you started:
A transmitter gets an acknowledgment back when the receiver gets a packet. (standard behaviour)
In the non-synchronised state, the transmitter and the receiver should agree on a hopping schedule.
Once the hopping schedule expires, the transmitter must send another hopping schedule.
if there is a failure, both parts revert to the non-synchronised state.
EDIT 1
Crossed with 2 previous posts.
EDIT 2
It is a pity that the exercise was not something even more useful like synchronising two battery powered NRF24L01 based parts parts, ensuring the receiver and transmitter periodically wake up more or less together, communicate, then sleep again. All that with minimum unused on time , and a recovery algorithm which designed to minimise power loss during resynchronisation.
6v6gt:
4) if there is a failure, both parts revert to the non-synchronised state.
There needs to be a pre-arranged default channel that both sides can revert to when they fail to make contact.
There should also be a means to deal with the situation where either the Tx or the Rx goes offline without warning for whatever reason - for example a power failure or program crash.
A large supply of coffee for late night debugging sessions will also be useful.