// Ping-Pong radio communication program
// T. Braunl, May 2017

#include "eyebot.h"
#define MAX 10

int main ()
{ int  i, my_id, partner;
  char buf[MAX];

  RADIOInit();
  my_id = RADIOGetID();
  LCDPrintf("my id %d\n", my_id);

  if (my_id==1)   // master only
  { partner=2;    // robot 1 --> robot 2
    RADIOSend(partner, "A");
  }
  else partner=1; // robot 2 --> robot 1
  
  for (i=0; i<10; i++)
  { RADIOReceive(&partner, buf, MAX);
    LCDPrintf("received from %d text %s\n", partner, buf);
    buf[0]++;  // increment first character of message
    RADIOSend(partner, buf);
  }
  KEYWait(KEY4); // make sure window does not close
}

