25 #include <phidget21.h> 32 const char *deviceptr, *label;
33 CPhidget_getDeviceType(phid, &deviceptr);
34 CPhidget_getSerialNumber(phid, &sernum);
35 CPhidget_getDeviceVersion(phid, &version);
36 CPhidget_getDeviceLabel(phid, &label);
38 printf(
"%s\n", deviceptr);
39 printf(
"Version: %8d SerialNumber: %10d\n", version, sernum);
40 printf(
"Label: %s\n", label);
51 CPhidgetInterfaceKit_getSensorValue(IFK,0, &
wert[0+(10*
i)]);
53 CPhidgetInterfaceKit_getSensorValue(IFK,1, &
wert[1+(10*
i)]);
55 CPhidgetInterfaceKit_getSensorValue(IFK,2, &
wert[2+(10*
i)]);
57 CPhidgetInterfaceKit_getSensorValue(IFK,3, &
wert[3+(10*
i)]);
75 if ((
wert[94] < 120) && (
wert[95] <300) && (
wert[96] < 110) && (
wert[97] < 120))
77 printf(
"Sensor0123 manually are %d %d %d %d ; \n",
wert[94],
wert[95],
wert[96],
wert[97]);
78 printf(
"tablet empty\n");
82 printf(
"Sensor0123 manually are %d %d %d %d ; \n",
wert[94],
wert[95],
wert[96],
wert[97]);
83 printf(
"tablet NOT empty!\n");
86 for(
i = 0;
i < 100;
i++)
91 printf(
"i is %d \n",
i);
99 printf(
"Attach handler ran!\n");
105 int numInputs, numOutputs, numSensors;
108 CPhidgetInterfaceKitHandle IFK = 0;
109 CPhidget_enableLogging(PHIDGET_LOG_VERBOSE, NULL);
110 CPhidgetInterfaceKit_create(&IFK);
114 CPhidget_open((CPhidgetHandle)IFK, -1);
117 if((err = CPhidget_waitForAttachment((CPhidgetHandle)IFK, 0)) != EPHIDGET_OK )
120 CPhidget_getErrorDescription(err, &errStr);
121 printf(
"Error waiting for attachment: (%d): %s\n",err,errStr);
126 CPhidgetInterfaceKit_getOutputCount((CPhidgetInterfaceKitHandle)IFK, &numOutputs);
127 CPhidgetInterfaceKit_getInputCount((CPhidgetInterfaceKitHandle)IFK, &numInputs);
128 CPhidgetInterfaceKit_getSensorCount((CPhidgetInterfaceKitHandle)IFK, &numSensors);
129 CPhidgetInterfaceKit_setOutputState((CPhidgetInterfaceKitHandle)IFK, 0, 1);
131 printf(
"Sensors:%d Inputs:%d Outputs:%d\n", numSensors, numInputs, numOutputs);
144 CPhidgetInterfaceKit_setOutputState(IFK, 7, 1);
145 CPhidgetInterfaceKit_setOutputState(IFK, 7, 0);
150 CPhidgetInterfaceKit_setOutputState(IFK, 0, 1);
152 CPhidgetInterfaceKit_setOutputState(IFK, 0, 0);
154 CPhidgetInterfaceKit_setOutputState(IFK, 0, 1);
156 CPhidgetInterfaceKit_setOutputState(IFK, 0, 0);
161 CPhidget_close((CPhidgetHandle)IFK);
162 CPhidget_delete((CPhidgetHandle)IFK);
167 int main(
int argc,
char* argv[])
void display_generic_properties(CPhidgetHandle phid)
int main(int argc, char *argv[])
int IFK_SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *userptr, int Index, int Value)
int IFK_AttachHandler(CPhidgetHandle IFK, void *userptr)