Update of /cvsroot/libphidget/libphidget/src/examples
In directory sc8-pr-cvs1:/tmp/cvs-serv9228/examples
Modified Files:
phidget_c.c
Log Message:
Added an example in phidget_c to test the reading of the 888 interface kit (assuming the low end library has it working)
Index: phidget_c.c
===================================================================
RCS file: /cvsroot/libphidget/libphidget/src/examples/phidget_c.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** phidget_c.c 24 Jun 2003 02:43:51 -0000 1.22
--- phidget_c.c 30 Jun 2003 02:53:27 -0000 1.23
***************
*** 25,28 ****
--- 25,29 ----
int SERVO8=0;
int IK488=0;
+ int IK888=0;
int IKDIGITALWRITE=0;
int IK880=0;
***************
*** 71,74 ****
--- 72,76 ----
printf(" IK488 - test 488 interface kit\n");
printf(" IK880 - test 880 interface kit\n");
+ printf(" IK888 - test 888 interface kit\n");
printf(" IKDIGITALWRITE - write data to the 488 or 880 interface kit\n");
printf(" TEXTLCD - test text lcd\n");
***************
*** 90,93 ****
--- 92,96 ----
if (strcmp(argv[1],"IK488")==0) IK488=1;
if (strcmp(argv[1],"IK880")==0) IK880=1;
+ if (strcmp(argv[1],"IK888")==0) IK888=1;
if (strcmp(argv[1],"IKDIGITALWRITE")==0) IKDIGITALWRITE=1;
if (strcmp(argv[1],"TEXTLCD")==0) TEXTLCD=1;
***************
*** 222,225 ****
--- 225,265 ----
analog[2],
analog[3]);
+
+
+ }
+ }
+
+ if (IK888)
+ if (phidgetTypeDeviceClass (phidgetType (dev)) == LP_INTERFACE_KIT_888)
+ {
+ int t,k;
+
+ while(1)
+ {
+ float analog[8];
+ int digital[8];
+ if (phidgetInterfaceKit888Read(dev,analog,digital)<0)
+ {
+ printf("error - %s\n",phidgetErrorString(phidgetLastError()));
+ return(-1);
+ }
+
+ printf("%c%c%c%c%c%c%c%c %8f %8f %8f %8f %8f %8f %8f %8f\n",
+ digital[0]==1 ? '*' : '-',
+ digital[1]==1 ? '*' : '-',
+ digital[2]==1 ? '*' : '-',
+ digital[3]==1 ? '*' : '-',
+ digital[4]==1 ? '*' : '-',
+ digital[5]==1 ? '*' : '-',
+ digital[6]==1 ? '*' : '-',
+ digital[7]==1 ? '*' : '-',
+ analog[0],
+ analog[1],
+ analog[2],
+ analog[3],
+ analog[4],
+ analog[5],
+ analog[6],
+ analog[7]);
|