// Ping-Pong radio communication program
// Test program sending to itself
// T. Braunl, May 2017

#include "eyebot.h"
#define MAX  10
#define ITER 10

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

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

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

