/* * * * *
 * array-move.c
 *
 * Make the Scribbler move in different speeds and times by putting different
 * numbers to different arrays and giving them as parameters to the commands
 * rForward and rTurnLeft.
 *
 * Authors: Dilan Ustek, Erik Opavsky (8 Jul 2011)
 * Revised: Jerod Weinman (11 Jan 2015)
 */

#include <MyroC.h>


#define NUM_MOVES 8

int
main (void)
{
  rConnect ("/dev/rfcomm0");

  /* the various speeds and times in two separate arrays */
  double speed[NUM_MOVES] = {0.3, 0.2, 0.4, 1.0, 1.0, 0.3, 0.2, 0.5};
  double time[NUM_MOVES]  = {0.3, 1.0, 0.6, 0.1, 1.0, 0.9, 0.3, 0.8};

  /* go forward and turn for the speeds and times given by the two arrays */
  for (int i = 0; i < NUM_MOVES; i++)
  {
    rForward (speed[i], time[i]);
    rTurnLeft (speed[i], time[i]);
  }
  
  rBeep (1, 500);

  rDisconnect();
  return 0;
} // main
