// EyeBot Demo Program: Drive, T. Bräunl, Nov. 2015
#include "eyebot.h"

int main()
{ int i, d;
  for (i=0; i<2; i++)       // run twice
  { LCDPrintf("Drive straight\n");
    VWStraight(1000, 200);  // 1m in ca. 5s
    while (!VWDone())
      if ((d=PSDGet(PSD_FRONT)) < 100)
      { VWSetSpeed(0,0);    // STOP if obstacle in front
        LCDPrintf("STOP, distance %d\n", d);
      }
    LCDPrintf("Rotate\n");
    VWTurn(180, 60);        // half turn in ca. 3s
    VWWait();          // wait until completed
  }
}
