/*	PONTECH Copyright 1996
 *	Sample SV200 interface
 *  QTEST.C
 *  	Quick Test of SV_LIB and COMM for the SV200 board.
 */

#include <stdio.h>
#include <stdlib.h>
#include "comm.h"
#include "comm.c"		/* don't need this line if include in project */
#include "sv_lib.h"
#include "sv_lib.c"	/* don't need this line if include in project */

int main()
{
	int port;

	clrscr();

	port = COM1;
	serlSetIntr(port);
	if ((serlPortInit(port,9600,0,8,1)) == -1)
	{
		printf("Can not connect to the SV200\n");
		return 0;
	}

	printf("Quick Test of SV_LIB and COMM for the SV200 board.\n");

	MasterDelay = 1000; /* one second delay between moves */

	move(SERVO1, 145);  printf("move(SERVO1, 145)\n");
	move(SERVO1, 100);	printf("move(SERVO1, 100)\n");

	move(SERVO2, 100);	printf("move(SERVO2, 145)\n");
	move(SERVO2, 160);	printf("move(SERVO2, 160)\n");

	MasterDelay = 500; /* half second delay between moves */

	moveAll(50, 50,NC,NC,NC,NC,NC,NC);
	printf("moveAll(50, 50,NC,NC,NC,NC,NC,NC);\n");

	moveAll(150, NC,NC,NC,NC,NC,NC,NC);
	printf("moveAll(150, NC,NC,NC,NC,NC,NC,NC);\n");

	moveAll(230, 230,NC,NC,NC,NC,NC,NC);
	printf("moveAll(230, 230,NC,NC,NC,NC,NC,NC);\n");

	moveAll(50, 50,NC,NC,NC,NC,NC,NC);
	printf("moveAll(50, 50,NC,NC,NC,NC,NC,NC);\n");

	move(SERVO1, 50);
	printf("move(SERVO1, 50)\n");

	slowMove(SERVO1, 200, 3);		/* slow */
	printf("slowMove(SERVO1, 200, 3)\n");
	slowMove(SERVO1, 30, 5); 		/* slower */
	printf("slowMove(SERVO1, 30, 5)\n");
	slowMove(SERVO1, 200, 15); 	/* even slower */
	printf("slowMove(SERVO1, 200, 15)\n");

	serlClosePort(port);
	return 1;
}

