/* Program to perform a simple robot dance step six times */ #include #include int main () { /* preliminaries */ printf ("this program repeats a simple robot dance step six times\n"); rConnect ("/dev/rfcomm0"); int counter; // variable to keep track of dance step repetitions /* repeat simple robot dance step six times */ for (counter = 0; counter < 6; counter++) { /* basic robot dance step */ rTurnRight (0.8, 0.6); /* turn right at 80% speed (max speed is 1.0) for 6/10 seconds */ rTurnLeft (0.8, 0.4); /* turn left at 80% speed for 4/10 seconds */ rForward (0.75, 0.8); /* move forward at 3/4 speed for 0.8 seconds */ rBackward (0.5, 1.2); /* move backward at half speed for 1.2 seconds */ } /* wrap up */ printf ("dance finished\n"); rDisconnect (); return 0; }