#include <eyebot.h>
	
int main()
{ float time;
  struct timeval stop, start;

  while (1)
  { LCDPrintf("Reaction Test\n");
    LCDMenu("GO","GO","GO","END");
    if (KEYGet()==KEY4) return 0;
    time = 1000.0 + 7000.0 * drand48(); // 1..8 sec
    LCDMenu(" "," "," "," ");
    usleep(1000 * (int) time);

    LCDMenu("HIT","HIT","HIT","HIT");
    if (KEYRead()) LCDPrintf("No cheating !!\n\n");
    else
    { gettimeofday(&start, NULL);
      KEYWait(ANYKEY);
      gettimeofday(&stop, NULL);
      LCDPrintf("time: %lu micro sec\n\n", (stop.tv_sec - start.tv_sec)*1000000 + (stop.tv_usec - start.tv_usec));
    }
  }
}