[Libphidget-cvs-commits] CVS: libphidget/src/examples phidget_c.c,1.18,1.19
Status: Alpha
Brought to you by:
jstrohm
From: Jack S. <js...@us...> - 2002-12-23 04:38:44
|
Update of /cvsroot/libphidget/libphidget/src/examples In directory sc8-pr-cvs1:/tmp/cvs-serv25634/examples Modified Files: phidget_c.c Log Message: Lot's of changes with how servo controller classes work. Now added seperate classes for servo controllers (uni and quad). Index: phidget_c.c =================================================================== RCS file: /cvsroot/libphidget/libphidget/src/examples/phidget_c.c,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** phidget_c.c 17 Dec 2002 22:12:11 -0000 1.18 --- phidget_c.c 23 Dec 2002 04:38:39 -0000 1.19 *************** *** 21,25 **** int t, count; struct phidget **phidgets; ! int SERVO=0; int IK488=0; int IKDIGITALWRITE=0; --- 21,27 ---- int t, count; struct phidget **phidgets; ! int SERVO1=0; ! int SERVO4=0; ! int SERVO8=0; int IK488=0; int IKDIGITALWRITE=0; *************** *** 81,87 **** if (argn==2) { ! if (strcmp(argv[1],"SERVO1")==0) SERVO=1; ! if (strcmp(argv[1],"SERVO4")==0) SERVO=1; ! if (strcmp(argv[1],"SERVO8")==0) SERVO=1; if (strcmp(argv[1],"IK488")==0) IK488=1; if (strcmp(argv[1],"IK880")==0) IK880=1; --- 83,89 ---- if (argn==2) { ! if (strcmp(argv[1],"SERVO1")==0) SERVO1=1; ! if (strcmp(argv[1],"SERVO4")==0) SERVO4=1; ! if (strcmp(argv[1],"SERVO8")==0) SERVO8=1; if (strcmp(argv[1],"IK488")==0) IK488=1; if (strcmp(argv[1],"IK880")==0) IK880=1; *************** *** 131,136 **** } ! if (SERVO) ! if (phidgetTypeDeviceClass (phidgetType (dev)) == LP_SERVO_CONTROLLER) { for (k = 0; k < 1; k += .1) --- 133,140 ---- } ! if ( ! (SERVO1 && phidgetTypeDeviceClass (phidgetType (dev)) == LP_UNI_SERVO) || ! (SERVO4 && phidgetTypeDeviceClass (phidgetType (dev)) == LP_QUAD_SERVO) ! ) { for (k = 0; k < 1; k += .1) *************** *** 139,148 **** printf ("%f\n",k); ! // Move a single servo (will move servo 0 of a 1 or 4 servo controller) ! //if (phidget8Servo (dev, k,0,.1,.1)<0) ! if (phidgetSingleServo (dev, k)<0) { ! printf("error - %s\n",phidgetErrorString(phidgetLastError())); ! return(5); } --- 143,164 ---- printf ("%f\n",k); ! // Move a single servo (will move ! ! if (SERVO1) { ! if (phidgetSingleServo (dev, k)<0) ! { ! printf("error - %s\n",phidgetErrorString(phidgetLastError())); ! return(5); ! } ! } ! ! if (SERVO4) ! { ! if (phidgetQuadServo (dev, k,k,k,k)<0) ! { ! printf("error - %s\n",phidgetErrorString(phidgetLastError())); ! return(5); ! } } |