Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > bfa8d3d691d0a342cec73ddfa2abcc84 > files > 28

nqc-doc-3.1.7-8.fc15.i686.rpm

/*  10 SQUARES

    by Mark Overmars

This program make the robot run 10 squares
*/

#define MOVE_TIME   100     // Time for a straight move
#define TURN_TIME    75     // Time for turning 90 degrees

task main()
{
  repeat(10)                // Make 10 squares
  {
    repeat(4)
    {
      OnFwd(OUT_A+OUT_B);
      Wait(MOVE_TIME);
      OnRev(OUT_B);
      Wait(TURN_TIME);
    }
  }
  Off(OUT_A+OUT_B);         // Now turn the motors off
}