/************************************************************************
 * Title        srvme.c                                                 *
 * Programmer	Keith L. Doty	        				*
 * Date         May 03, 1999                                            *
 * Version	1			                		*
 *								        *
 * Description								*
 *   Input two integers to specify the speed and direction of the left  *
 *   and right wheels. The integers must lie between -100 and +100. Any *
 *   non-digit character will terminate the integer, e.g., a blank.     *
 *									*
 *   	      CAREFUL!!! The robot will start moving immediately!	*
 *									*
 * Use Hyperterm with the following settings:                           *
 *   									*
 *      COM1, 9600 Baud, 8 bits, No Parity, 1 Stop bit, No Flow         *
 *      of Control, VT100 Terminal, WrapLines.				*
 *									*
 *									*
 *   To input another pair of speeds, press reset to start the program  *
 *   over. 								*
 *									*
 *  Usage: This program allows you to move the robot at any fixed       *
 *         wheel speed ratios to generate either straight or circular	*
 *         motion.  							*
 ************************************************************************/
 
/**************************** Includes **********************************/
#include <tjpbase.h>
#include <stdio.h>
/************************ End of includes *******************************/


void main(void)
/****************************** Main ***********************************/
{
  int PW3, PW7;
/* VT100 clear screen */ 
  char c1, clear[]= "\x1b\x5B\x32\x4A\x04"; 

/* VT100 position cursor at (x,y) = (3,12) command is "\x1b[3;12H"*/
  char place[]= "\x1b[1;1H";	/*Home*/	

  init_servome();
  init_serial();
  init_clocktjp();
  
while(1)
{

  printf("%s", clear);  
  printf("%s", place);
  
  printf("\tTitle\t\txm2tk.c\n"
  "\tProgrammer\tKeith L. Doty\n"
  "\tDate\t\tMay 03, 1999\n"
  "\tVersion\t\t1\n\n");

  printf("Pulse Width for Servo on PA3: 1000<PW3<4000 or PW3=0:   ");
  PW3 = read_int();

  printf("Pulse Width for Servo on PA7: 1000<PW7<4000 or PW7=0:   ");
  PW7 = read_int();

  servo(0, PW3);
  servo(2, PW7);
  
  printf("Type any character to input new data.");
  c1 = get_char();
}

  
}
/**************************** End of Main ******************************/
