Virtual Wire - used in effency way for manage several devices

Good Morning, I've read the standard example for the virtual wire lybrary... and this is my scenario : I'd like to manage in effency way the " LED " do you have something to suggest ?

What I'd like from the Master:

  • say to the several client turn on / off when the relative button is pressed (this is did without a particular problem)
  • receive the slave state and turn on / off the a led connected to the client .

Example :

  • send 1 --> turn on client 1 --> then should receive from the client1 a ok msg for example "OK1" after the client is turned on then should turn on a led related at the client 1 connected to the master

What I've Did for the slave:

Slave: - the slave is in rx mode wait msg from the network and receive it - if the data is not for the client re-trasmitt it over the netowrk - if the data is for the client do this control:

example. 1 = ON 0 = OFF

if msgin = 1 and ledstate = 1 --> new state = 1 --> digitalWrite(led, new state) if msgin = 0 and ledstate = 0 --> new state = 0 --> digitalWrite(led, new state) if msgin = 0 and ledstate = 1 --> new state = 1 --> digitalWrite(led, new state) if msgin = 0 and ledstate = 0 --> new state = 0 --> digitalWrite(led, new state)

then send back to the master the message ok I'm turn on / Off

The difficult is how to manage Rx and tx from the master with several devices ... so if some of can help could be great ....

thanks in advance, Gnux