示例#1
0
//Display the properties of the attached phidget to the screen.  We will be displaying the name, serial number and version of the attached device.
//Will also display the number of inputs, outputs, and analog inputs on the interface kit as well as the state of the ratiometric flag
//and the current analog sensor sensitivity.
int IKDisplayProperties(CPhidgetInterfaceKitHandle phid)
{
	int serialNo, version, numInputs, numOutputs, numSensors, triggerVal, ratiometric, i;
	const char* ptr;

	CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
	CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
	CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

	CPhidgetInterfaceKit_getInputCount(phid, &numInputs);
	CPhidgetInterfaceKit_getOutputCount(phid, &numOutputs);
	CPhidgetInterfaceKit_getSensorCount(phid, &numSensors);
	CPhidgetInterfaceKit_getRatiometric(phid, &ratiometric);

	SetupLog("%s", ptr);
	SetupLog("Serial Number: %10d\nVersion: %8d", serialNo, version);
	SetupLog("# Digital Inputs: %d\n# Digital Outputs: %d", numInputs, numOutputs);
	SetupLog("# Sensors: %d", numSensors);
	SetupLog("Ratiometric: %d", ratiometric);

	for(i = 0; i < numSensors; i++)
	{
		CPhidgetInterfaceKit_getSensorChangeTrigger (phid, i, &triggerVal);

		SetupLog("Sensor#: %d > Sensitivity Trigger: %d\n", i, triggerVal);
	}

	return 0;
}
示例#2
0
int display_properties(CPhidgetPHSensorHandle phid)
{
    int serialNo, version;
    double trigger, potential;
    double min, max;
    const char* ptr;

    CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
    CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
    CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

    CPhidgetPHSensor_getPHChangeTrigger(phid, &trigger);
    CPhidgetPHSensor_getPotential(phid, &potential);

    ROS_INFO("%s\n", ptr);
    ROS_INFO("Serial Number: %10d\nVersion: %8d\n",
			 serialNo, version);
    ROS_INFO("Trigger Sensitivity: %f\nPotential: %f\n",
			 trigger, potential);
    CPhidgetPHSensor_getPHMax(phid, &max);
    CPhidgetPHSensor_getPHMin(phid, &min);
    ROS_INFO("Max PH: %0.4lf, Min PH: %0.4lf\n", max, min);
    CPhidgetPHSensor_getPotentialMax(phid, &max);
    CPhidgetPHSensor_getPotentialMin(phid, &min);
    ROS_INFO("Max Potential: %0.2lfmV, " \
			 "Min Potential: %0.2lfmV\n", max, min);

    return 0;
}
示例#3
0
int main(int argc, char* argv[]) {

    int result, numOutputs = 3, state = 0; 
    const char *err, *ptr;
    CPhidgetInterfaceKitHandle phid = 0;

    LocalErrorCatcher(CPhidgetInterfaceKit_create(&phid));
    
    LocalErrorCatcher(CPhidget_set_OnAttach_Handler((CPhidgetHandle) phid, AttachHandler, NULL));
    LocalErrorCatcher(CPhidget_set_OnDetach_Handler((CPhidgetHandle) phid, DetachHandler, NULL));
    LocalErrorCatcher(CPhidget_set_OnError_Handler((CPhidgetHandle) phid, ErrorHandler, NULL));

//    printf("Phidget Simple Playground (plug and unplug devices)\n");
//    printf("Opening...\n");
    LocalErrorCatcher(CPhidget_open((CPhidgetHandle) phid, -1));
    LocalErrorCatcher(CPhidget_waitForAttachment((CPhidgetHandle) phid, 100000));

    CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
    CPhidgetInterfaceKit_getOutputCount(phid, &numOutputs);
//    printf("%s\n", ptr);

    printf("Turning power on\n");			    
    CPhidgetInterfaceKit_setOutputState(phid, 0, 1);
	
	printf("done\n");
    LocalErrorCatcher(CPhidget_close((CPhidgetHandle) phid));
    LocalErrorCatcher(CPhidget_delete((CPhidgetHandle) phid));

    return 0;
}
//Display the properties of the attached phidget(s) to the screen.  We will be displaying the name, serial number and version of the attached device(s).
int display_devices(CPhidgetManagerHandle MAN)
{
	int serialNo, version, numDevices, i;
	const char* ptr;
	CPhidgetHandle *devices;

	CPhidgetManager_getAttachedDevices (MAN, &devices, &numDevices);

	printf("|-   # -|-              Type              -|- Serial No. -|-  Version -|\n");
	printf("|-------|----------------------------------|--------------|------------|\n");


	for(i = 0; i < numDevices; i++)
	{
		CPhidget_getDeviceType(devices[i], &ptr);
		CPhidget_getSerialNumber(devices[i], &serialNo);
		CPhidget_getDeviceVersion(devices[i], &version);

		printf("|- %3d -|- %30s -|- %10d -|- %8d -|\n", i, ptr, serialNo, version);
		printf("|-------|----------------------------------|--------------|------------|\n");
	}

	CPhidgetManager_freeAttachedDevicesArray(devices);

	return 0;
}
示例#5
0
int display_properties(CPhidgetAccelerometerHandle phid)
{
    int serial_number, version, num_axes;
    const char* ptr;

    CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
    CPhidget_getSerialNumber((CPhidgetHandle)phid,
							 &serial_number);
    CPhidget_getDeviceVersion((CPhidgetHandle)phid,
							  &version);

    CPhidgetAccelerometer_getAxisCount((CPhidgetAccelerometerHandle)phid,
									   &num_axes);

    // initialise acceleration values
    ros::Time begin = ros::Time::now();
    acc.acceleration.clear();
    acc.stamp.clear();
    for (int i = 0; i < num_axes; i++) {
        acc.acceleration.push_back(0);
        acc.stamp.push_back(begin);
        acc.stamp.push_back(begin);
        acc.stamp.push_back(begin);
    }

    ROS_INFO("%s", ptr);
    ROS_INFO("Serial Number: %d", serial_number);
    ROS_INFO("Version: %d", version);
    ROS_INFO("Number of axes %d", num_axes);

    return 0;
}
int display_properties(CPhidgetInterfaceKitHandle phid)
{
    int serial_number, version, ratiometric, num_sensors, num_inputs, num_outputs, triggerVal;
    const char* ptr;

    CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
    CPhidget_getSerialNumber((CPhidgetHandle)phid, &serial_number);
    CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

    CPhidgetInterfaceKit_getInputCount(phid, &num_inputs);
    CPhidgetInterfaceKit_getOutputCount(phid, &num_outputs);
    CPhidgetInterfaceKit_getSensorCount(phid, &num_sensors);
    CPhidgetInterfaceKit_getRatiometric(phid, &ratiometric);

    ROS_INFO("%s", ptr);
    ROS_INFO("Serial Number: %d", serial_number);
    ROS_INFO("Version: %d", version);
    ROS_INFO("Number of digital inputs %d", num_inputs);
    ROS_INFO("Number of digital outputs %d", num_outputs);
    ROS_INFO("Number of sensors %d", num_sensors);
    ROS_INFO("Ratiometric %d", ratiometric);

    for (int i = 0; i < num_sensors; i++)
    {       
        CPhidgetInterfaceKit_getSensorChangeTrigger (phid, i, &triggerVal);
        //CPhidgetInterfaceKit_setSensorChangeTrigger (phid, i, 10);
	ROS_INFO("Sensor %d Sensitivity Trigger %d", i, triggerVal);
    }

    return 0;
}
// display the properties and create the ifkit model. Should really refactor...
int PhidgetConnector::display_properties(CPhidgetInterfaceKitHandle phid) {

    int serialNo, version, numInputs, numOutputs, numSensors, triggerVal, ratiometric, i;
    const char* ptr;

    CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
    CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
    CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

    CPhidgetInterfaceKit_getInputCount(phid, &numInputs);
    CPhidgetInterfaceKit_getOutputCount(phid, &numOutputs);
    CPhidgetInterfaceKit_getSensorCount(phid, &numSensors);
    CPhidgetInterfaceKit_getRatiometric(phid, &ratiometric);
    ifKitModels.push_back(new IFKitModel(serialNo, numSensors));



    printf("%s\n", ptr);
    printf("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
    printf("# Digital Inputs: %d\n# Digital Outputs: %d\n", numInputs, numOutputs);
    printf("# Sensors: %d\n", numSensors);
    printf("Ratiometric: %d\n", ratiometric);

    for(i = 0; i < numSensors; i++) {
        CPhidgetInterfaceKit_setSensorChangeTrigger(phid, i, 0);
        CPhidgetInterfaceKit_getSensorChangeTrigger (phid, i, &triggerVal);
        printf("Sensor#: %d > Sensitivity Trigger: %d\n", i, triggerVal);
    }

    return 0;
}
示例#8
0
//Display the properties of the attached phidget to the screen.  We will be displaying the name, serial number and version of the attached device.
int display_properties(CPhidgetTextLCDHandle phid)
{
	int serialNo, version, numRows, numColumns, backlight, cursor, contrast, cursor_blink, numScreens;
	const char* ptr;
	CPhidget_DeviceID id;
	
	CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
	CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
	CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);
	CPhidget_getDeviceID((CPhidgetHandle)phid, &id);

	CPhidgetTextLCD_getRowCount (phid, &numRows);
	CPhidgetTextLCD_getColumnCount (phid, &numColumns);
	CPhidgetTextLCD_getBacklight (phid, &backlight);
	CPhidgetTextLCD_getContrast (phid, &contrast);
	CPhidgetTextLCD_getCursorOn (phid, &cursor);
	CPhidgetTextLCD_getCursorBlink (phid, &cursor_blink);

	printf("%s\n", ptr);
	printf("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
	if(id == PHIDID_TEXTLCD_ADAPTER){
		CPhidgetTextLCD_getScreenCount (phid, &numScreens);
		printf("# Screens: %d\n", numScreens);
		CPhidgetTextLCD_setScreen(phid, 0);
		CPhidgetTextLCD_setScreenSize(phid, PHIDGET_TEXTLCD_SCREEN_2x16);
		CPhidgetTextLCD_initialize(phid);
	}

	printf("# Rows: %d\n# Columns: %d\n", numRows, numColumns);
	printf("Current Contrast Level: %d\nBacklight Status: %d\n", contrast, backlight);
	printf("Cursor Status: %d\nCursor Blink Status: %d\n", cursor, cursor_blink);

	return 0;
}
示例#9
0
int display_properties(CPhidgetSpatialHandle phid)
{
    int serialNo, version;
    const char* ptr;
    int numAccelAxes, numGyroAxes, numCompassAxes;
	int dataRateMax, dataRateMin;

    CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
    CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
    CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);
    CPhidgetSpatial_getAccelerationAxisCount((CPhidgetSpatialHandle)phid,
											 &numAccelAxes);
    CPhidgetSpatial_getGyroAxisCount((CPhidgetSpatialHandle)phid,
									 &numGyroAxes);
    CPhidgetSpatial_getCompassAxisCount((CPhidgetSpatialHandle)phid,
										&numCompassAxes);
    CPhidgetSpatial_getDataRateMax((CPhidgetSpatialHandle)phid,
								   &dataRateMax);
    CPhidgetSpatial_getDataRateMin((CPhidgetSpatialHandle)phid,
								   &dataRateMin);

    ROS_INFO("%s\n", ptr);
    ROS_INFO("Serial Number: %10d\nVersion: %8d\n",
			 serialNo, version);
    ROS_INFO("Number of Accel Axes: %i\n", numAccelAxes);
    ROS_INFO("Number of Gyro Axes: %i\n", numGyroAxes);
    ROS_INFO("Number of Compass Axes: %i\n", numCompassAxes);
    ROS_INFO("datarate> Max: %d  Min: %d\n",
			 dataRateMax, dataRateMin);

    return 0;
}
Wt::WContainerWidget* WidgetsCommon::CreateWidget()
{
	PhidgetsInfo* item = ::GetPhidgetManager()->FindPhidgetBySerial(GetSerial());
	if (!item)
		return NULL;
	
	CPhidgetHandle handle = item->m_phidget->GetHandle();

	Wt::WContainerWidget* tab_container = new Wt::WContainerWidget();
  Wt::WHBoxLayout* hbox = new Wt::WHBoxLayout(tab_container);
	
	Wt::WTable* table = new Wt::WTable();
	hbox->addWidget(table);
	
	table->columnAt(0)->setWidth(GetLeftColumnWidth());
	table->columnAt(1)->setWidth(Wt::WLength::Auto);

	int row = 0;
	const char* string_value;
	int int_value;
	if (EPHIDGET_OK == CPhidget_getDeviceName(handle, &string_value))
	{
		table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("DeviceName")));
		table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString(string_value, Wt::UTF8)));
	}
	
	if (EPHIDGET_OK == CPhidget_getSerialNumber(handle, &int_value))
	{
		table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("SerialNumber")));
		table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString("{1}").arg(int_value)));
	}

	if (EPHIDGET_OK == CPhidget_getDeviceVersion(handle, &int_value))
	{
		table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("DeviceVersion")));
		table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString("{1}").arg(int_value)));
	}

	if (EPHIDGET_OK == CPhidget_getDeviceStatus(handle, &int_value))
	{
		table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("DeviceStatus")));
		table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString("{1}").arg(int_value)));
	}

	if (EPHIDGET_OK == CPhidget_getDeviceType(handle, &string_value))
	{
		table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("DeviceType")));
		table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString(string_value, Wt::UTF8)));
	}

	if (EPHIDGET_OK == CPhidget_getDeviceLabel(handle, &string_value))
	{
		table->elementAt(row, 0)->addWidget(new Wt::WText(Wt::WString::tr("DeviceLabel")));
		table->elementAt(row++, 1)->addWidget(new Wt::WText(Wt::WString(string_value, Wt::UTF8)));
	}

	return tab_container;
}
示例#11
0
int main(int argc, char* argv[]) {
  // Set up a SIGINT handler.
  signal(SIGINT, catch_sigint);

  // Create the InterfaceKit object.
  CPhidgetInterfaceKitHandle ifKit = 0;
  CPhidgetInterfaceKit_create(&ifKit);

  // Register device handlers.
  CPhidget_set_OnAttach_Handler((CPhidgetHandle)ifKit, attach_handler, NULL);
  CPhidget_set_OnDetach_Handler((CPhidgetHandle)ifKit, detach_handler, NULL);
  CPhidget_set_OnError_Handler((CPhidgetHandle)ifKit, error_handler, NULL);

  // Open the interfacekit for device connections.
  CPhidget_open((CPhidgetHandle)ifKit, -1);

  // Wait for a device attachment.
  fprintf(stderr, "waiting for interface kit to be attached....\n");
  int result;
  const char *err;
  if ((result = CPhidget_waitForAttachment((CPhidgetHandle)ifKit, 10000))) {
    CPhidget_getErrorDescription(result, &err);
    fprintf(stderr, "problem waiting for attachment: %s\n", err);
    return 0;
  }

  // Check some properties of the device.
  const char *device_type;
  int num_outputs;
  CPhidget_getDeviceType((CPhidgetHandle)ifKit, &device_type);

  CPhidgetInterfaceKit_getOutputCount(ifKit, &num_outputs);
  if ((strcmp(device_type, "PhidgetInterfaceKit") != 0)) {
    fprintf(stderr, "unexpected device type: %s\n", device_type);
    return 1;
  }
  if (num_outputs != 4) {
    fprintf(stderr, "unexpected number of device outputs: %d\n", num_outputs);
    return 1;
  }

  while (1) {
    double time = get_time_in_seconds();
    double factor = 1;
    int l0_state = fmod(time * factor, 20) < 10;
    int l1_state = fmod(time * factor, 20) >= 10;
    CPhidgetInterfaceKit_setOutputState(ifKit, 0, l0_state);
    CPhidgetInterfaceKit_setOutputState(ifKit, 2, l1_state);
    usleep(100000);
  }

  fprintf(stderr, "shutting down...\n");
  CPhidget_close((CPhidgetHandle)ifKit);
  CPhidget_delete((CPhidgetHandle)ifKit);

  return 0;
}
示例#12
0
void ioPhidget::display_generic_properties(CPhidgetHandle phid)
{
    const char *deviceptr;
    CPhidget_getDeviceType(phid, &deviceptr);
    CPhidget_getSerialNumber(phid, &serialNumber);
    CPhidget_getDeviceVersion(phid, &version);
    
    printf("%s\n", deviceptr);
    printf("Version: %8d SerialNumber: %10d\n", version, serialNumber);
    return;
}
示例#13
0
JNIEXPORT jstring JNICALL
Java_com_phidgets_Phidget_getDeviceType(JNIEnv *env, jobject obj)
{
	CPhidgetHandle h = (CPhidgetHandle)(uintptr_t)(*env)->GetLongField(env,
	    obj, handle_fid);
	const char *type;
	int error;
	
	if ((error = CPhidget_getDeviceType(h, &type)))
		PH_THROW(error);

	return (*env)->NewStringUTF(env, type);
}
示例#14
0
void display_generic_properties(CPhidgetHandle phid)
{
	int sernum, version;
	const char *deviceptr, *label;
	CPhidget_getDeviceType(phid, &deviceptr);
	CPhidget_getSerialNumber(phid, &sernum);
	CPhidget_getDeviceVersion(phid, &version);
	CPhidget_getDeviceLabel(phid, &label);

	printf("%s\n", deviceptr);
	printf("Version: %8d SerialNumber: %10d\n", version, sernum);
	printf("Label: %s\n", label);
	return;
}
示例#15
0
	/** 
	  * Prints info about this motor
	  */
	void PhidgetLEDController::displayProperties()
	{
		int serialNo, version, numLED;
		const char* ptr;

		CPhidget_getDeviceType(getPhidgetHandle(), &ptr);
		CPhidget_getSerialNumber(getPhidgetHandle(), &serialNo);
		CPhidget_getDeviceVersion(getPhidgetHandle(), &version);
		CPhidgetLED_getLEDCount(m_LEDControl, &numLED);

		printf("%s\n", ptr);
		printf("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
		printf("# LEDs: %d\n", numLED);
	}
示例#16
0
int display_properties(CPhidgetHandle phid)
{
	int serialNo, version;
	const char* ptr;
	
	CPhidget_getDeviceType(phid, &ptr);
	CPhidget_getSerialNumber(phid, &serialNo);
	CPhidget_getDeviceVersion(phid, &version);

	printf("%s\n", ptr);
	printf("Serial Number: %10d\nVersion: %8d\n", serialNo, version);

	return 0;
}
示例#17
0
//Display the properties of the attached phidget to the screen.  We will be displaying the name, serial number and version of the attached device.
int display_properties(CPhidgetServoHandle phid)
{
	int serialNo, version, numMotors;
	const char* ptr;

	CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
	CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
	CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

	CPhidgetServo_getMotorCount (phid, &numMotors);

	printf("%s\n", ptr);
	printf("Serial Number: %10d\nVersion: %8d\n# Motors: %d\n", serialNo, version, numMotors);

	return 0;
}
示例#18
0
//Display the properties of the attached phidget to the screen.  We will be displaying the name, serial number and version of the attached device.
int ASDisplayProperties(CPhidgetAdvancedServoHandle phid)
{
	int serialNo, version, numMotors;
	const char* ptr;

	CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
	CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
	CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

	CPhidgetAdvancedServo_getMotorCount (phid, &numMotors);

	SetupLog("%s", ptr);
	SetupLog("Serial Number: %10d\nVersion: %8d\n# Motors: %d", serialNo, version, numMotors);

	return 0;
}
//Display the properties of the attached phidget to the screen.  We will be displaying the name, serial number and version of the attached device.
//We will also display the total number of available LEDs
int display_properties(CPhidgetLEDHandle phid)
{
	int serialNo, version, numLED;
	const char* ptr;

	CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
	CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
	CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);
	CPhidgetLED_getLEDCount(phid, &numLED);

	printf("%s\n", ptr);
	printf("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
	printf("# LEDs: %d\n", numLED);

	return 0;
}
//Display the properties of the attached phidget to the screen.  
//We will be displaying the name, serial number, version of the attached device and number of Axes on the accelerometer.
int display_properties(CPhidgetHandle phid)
{
	int serialNo, version;
	const char* ptr;
	int numAxes;

	CPhidget_getDeviceType(phid, &ptr);
	CPhidget_getSerialNumber(phid, &serialNo);
	CPhidget_getDeviceVersion(phid, &version);
	CPhidgetAccelerometer_getAxisCount((CPhidgetAccelerometerHandle)phid, &numAxes);

	printf("%s\n", ptr);
	printf("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
	printf("Number of Axes: %i\n", numAxes);

	return 0;
}
示例#21
0
int MCDisplayProperties(CPhidgetMotorControlHandle phid)
{
	int serialNo, version, numInputs, numMotors;
	const char* ptr;

	CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
	CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
	CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);
	
	CPhidgetMotorControl_getInputCount(phid, &numInputs);
	CPhidgetMotorControl_getMotorCount(phid, &numMotors);

	SetupLog("%s", ptr);
	SetupLog("Serial Number: %10d\nVersion: %8d", serialNo, version);
	SetupLog("# Inputs: %d\n# Motors: %d", numInputs, numMotors);

	return 0;
}
示例#22
0
	/** 
	  * Prints info about this controller
	  */
	void PhidgetAnalogOutController::displayProperties()
	{
		int serialNo, version, numAnalog;
		double max, min;
		const char* ptr;

		CPhidget_getDeviceType(getPhidgetHandle(), &ptr);
		CPhidget_getSerialNumber(getPhidgetHandle(), &serialNo);
		CPhidget_getDeviceVersion(getPhidgetHandle(), &version);
		CPhidgetAnalog_getOutputCount(m_analogOut, &numAnalog);
		CPhidgetAnalog_getVoltageMax(m_analogOut, 0, &max);
		CPhidgetAnalog_getVoltageMin(m_analogOut, 0, &min);

		printf("%s\n", ptr);
		printf("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
		printf("# Analog Outputs: %d\n", numAnalog);
		printf("Output range: -%0.1lfV - %0.1lfV\n",min,max);
	}
示例#23
0
void display_properties( CPhidgetAdvancedServoHandle phid )
{
	int serialNo, version, numMotors;
	const char* ptr;

	CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
	CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
	CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

	CPhidgetAdvancedServo_getMotorCount (phid, &numMotors);

	printf("%s\n", ptr);

	printf("Serial Number: %10d\nVersion: %8d\n# Motors: %d\n", serialNo, version, numMotors);

	printf( "Parameters:\nmin acceleration: %f\nmax acceleration: %f\nmin velocity: %f\nmax velocity: %f\n",
			minAcc, maxAcc, minVel, maxVel );
}
示例#24
0
//Display the properties of the attached phidget to the screen.  We will be displaying the name, serial number and version of the attached device.
//Will also display the number of inputs and encoders on this device
int display_properties(CPhidgetEncoderHandle phid)
{
	int serialNo, version, num_inputs, num_encoders;
	const char* ptr;

	CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
	CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
	CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

	CPhidgetEncoder_getInputCount(phid, &num_inputs);
	CPhidgetEncoder_getEncoderCount(phid, &num_encoders);

	printf("%s\n", ptr);
	printf("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
	printf("Num Encoders: %d\nNum Inputs: %d\n", num_encoders, num_inputs);

	return 0;
}
示例#25
0
//Display the properties of the attached phidget to the screen.  We will be displaying the name, serial number and version of the attached device.
int display_properties(CPhidgetPHSensorHandle phid)
{
	int serialNo, version;
	double trigger, potential;
	const char* ptr;

	CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
	CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
	CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

	CPhidgetPHSensor_getPHChangeTrigger(phid, &trigger);
	CPhidgetPHSensor_getPotential(phid, &potential);

	printf("%s\n", ptr);
	printf("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
	printf("Trigger Sensitivity: %f\nPotential: %f\n", trigger, potential);

	return 0;
}
int display_properties(CPhidgetRFIDHandle phid)
{
    int serialNo, version, numOutputs, antennaOn, LEDOn;
    const char* ptr;

    CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
    CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
    CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

    CPhidgetRFID_getOutputCount (phid, &numOutputs);
    CPhidgetRFID_getAntennaOn (phid, &antennaOn);
    CPhidgetRFID_getLEDOn (phid, &LEDOn);

    ROS_INFO("%s\n", ptr);
    ROS_INFO("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
    ROS_INFO("# Outputs: %d\n\n", numOutputs);
    ROS_INFO("Antenna Status: %d\nOnboard LED Status: %d\n", antennaOn, LEDOn);

    return 0;
}
int MotorDisplayProperties(CPhidgetMotorControlHandle phid)
{
	int serialNo, version, numInputs, numMotors;
	const char* ptr;

	CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
	CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
	CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

	CPhidgetMotorControl_getInputCount(phid, &numInputs);
	CPhidgetMotorControl_getMotorCount(phid, &numMotors);

    #if (DEBUG_MODE_LOW)
	printf("%s\n", ptr);
	printf("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
	printf("# Inputs: %d\n# Motors: %d\n", numInputs, numMotors);
    #endif

	return 0;
}
int display_properties(CPhidgetMotorControlHandle phid)
{
    int serial_number, version, num_motors, num_inputs;
    const char* ptr;

    CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
    CPhidget_getSerialNumber((CPhidgetHandle)phid,
                             &serial_number);
    CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

    CPhidgetMotorControl_getInputCount(phid, &num_inputs);
    CPhidgetMotorControl_getMotorCount(phid, &num_motors);

    ROS_INFO("%s", ptr);
    ROS_INFO("Serial Number: %d", serial_number);
    ROS_INFO("Version: %d", version);
    ROS_INFO("Number of motors %d", num_motors);
    ROS_INFO("Number of inputs %d", num_inputs);

    return 0;
}
//Display the properties of the attached phidget to the screen.  We will be displaying the name, serial number and version of the attached device.
int display_properties(CPhidgetTemperatureSensorHandle phid)
{
	int serialNo, version, numInputs, i;
	double value;
	const char* ptr;

	double min, max;

	CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
	CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
	CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

	CPhidgetTemperatureSensor_getTemperatureInputCount (phid, &numInputs);
	

	printf("%s\n", ptr);
	printf("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
	printf("# Temperature Inputs: %d\n", numInputs);

	for(i = 0; i < numInputs; i++)
	{
		CPhidgetTemperatureSensor_getTemperatureChangeTrigger (phid, i, &value);
		CPhidgetTemperatureSensor_getTemperatureMax(phid, i, &max);
		CPhidgetTemperatureSensor_getTemperatureMin(phid, i, &min);
		printf("Temperature Input #: %d > sensitivity: %f Max: %0.0f, Min: %0.0f\n", i, value, max, min);
	}

	CPhidgetTemperatureSensor_getPotentialMax(phid, 0, &max);
	CPhidgetTemperatureSensor_getPotentialMin(phid, 0, &min);
	printf("Potential Max: %0.3f, Min: %0.3f\n", max, min);

	CPhidgetTemperatureSensor_getAmbientTemperatureMax(phid, &max);
	CPhidgetTemperatureSensor_getAmbientTemperatureMin(phid, &min);
	printf("Ambient Sensor Max: %0.0f, Min: %0.0f\n", max, min);

	return 0;
}
示例#30
0
int display_properties(CPhidgetMotorControlHandle phid){
  int serialNo, version, numEncoders, numInputs, numMotors, numSensors, ratiometric;
  const char* ptr;

  CPhidget_getDeviceType((CPhidgetHandle)phid, &ptr);
  CPhidget_getSerialNumber((CPhidgetHandle)phid, &serialNo);
  CPhidget_getDeviceVersion((CPhidgetHandle)phid, &version);

  CPhidgetMotorControl_getEncoderCount(phid, &numEncoders);
  CPhidgetMotorControl_getInputCount(phid, &numInputs);
  CPhidgetMotorControl_getMotorCount(phid, &numMotors);
  CPhidgetMotorControl_getSensorCount(phid, &numSensors);
  CPhidgetMotorControl_getRatiometric(phid, &ratiometric);

  ROS_INFO("%s\n", ptr);
  ROS_INFO("Serial Number: %10d\nVersion: %8d\n", serialNo, version);
  ROS_INFO("# Encoders: %d\n", numEncoders);
  ROS_INFO("# Inputs: %d\n", numInputs);
  ROS_INFO("# Motors: %d\n", numMotors);
  ROS_INFO("# Sensors: %d\n", numSensors);
  ROS_INFO("Ratiometric: %d\n", ratiometric);

	return 0;
}