亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? interfacekit-simple.c

?? 基于phidget標準C程序樣例
?? C
字號:
// - InterfaceKit simple -
// This simple example simply creates an InterfaceKit handle, creates it, hooks the event handlers and opens it.  It then waits
// for an InterfaceKit to be attached and waits for events to be fired. We progress through three steps, 1. Normal settings, 
// 2. Setting analog sensor sensitivity to 100, 3. Toggling Ratiometric, waiting for user input to proceed to next step to allow 
// data to be read. For a more detailed example with the ability to see and manipulate all of the accelerometer
// Phidget's properties, see the Accelerometer-full example.
//
// Please note that this example was designed to work with only one Phidget InterfaceKit connected. For an example using multiple 
// Phidget InterfaceKits, please see a "multiple" example in the InterfaceKit Examples folder.
//
// Copyright 2007 Phidgets Inc.  All rights reserved.

#include <stdio.h>
#include <phidget21.h>

int AttachHandler(CPhidgetHandle IFK, void *userptr)
{
	int serialNo;
	const char *name;

	CPhidget_getDeviceName(IFK, &name);
	CPhidget_getSerialNumber(IFK, &serialNo);

	printf("%s %10d attached!\n", name, serialNo);

	return 0;
}

int DetachHandler(CPhidgetHandle IFK, void *userptr)
{
	int serialNo;
	const char *name;

	CPhidget_getDeviceName (IFK, &name);
	CPhidget_getSerialNumber(IFK, &serialNo);

	printf("%s %10d detached!\n", name, serialNo);

	return 0;
}

int ErrorHandler(CPhidgetHandle IFK, void *userptr, int ErrorCode, const char *unknown)
{
	printf("Error handled. %i - %s", ErrorCode, unknown);
	return 0;
}

//callback that will run if an input changes.
//Index - Index of the input that generated the event, State - boolean (0 or 1) representing the input state (on or off)
int InputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State)
{
	printf("Digital Input: %d > State: %d\n", Index, State);
	return 0;
}

//callback that will run if an output changes.
//Index - Index of the output that generated the event, State - boolean (0 or 1) representing the output state (on or off)
int OutputChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int State)
{
	printf("Digital Output: %d > State: %d\n", Index, State);
	return 0;
}

//callback that will run if the sensor value changes by more than the OnSensorChange trigger.
//Index - Index of the sensor that generated the event, Value - the sensor read value
int SensorChangeHandler(CPhidgetInterfaceKitHandle IFK, void *usrptr, int Index, int Value)
{
	printf("Sensor: %d > Value: %d\n", Index, Value);
	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.
//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 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_getNumInputs(phid, &numInputs);
	CPhidgetInterfaceKit_getNumOutputs(phid, &numOutputs);
	CPhidgetInterfaceKit_getNumSensors(phid, &numSensors);
	CPhidgetInterfaceKit_getRatiometric(phid, &ratiometric);

	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_getSensorChangeTrigger (phid, i, &triggerVal);

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

	

	return 0;
}


int interfacekit_simple()
{
	int result, numSensors, i;
	const char *err;

	//Declare an InterfaceKit handle
	CPhidgetInterfaceKitHandle ifKit = 0;

	//create the InterfaceKit object
	CPhidgetInterfaceKit_create(&ifKit);

	//Set the handlers to be run when the device is plugged in or opened from software, unplugged or closed from software, or generates an error.
	CPhidget_set_OnAttach_Handler((CPhidgetHandle)ifKit, AttachHandler, NULL);
	CPhidget_set_OnDetach_Handler((CPhidgetHandle)ifKit, DetachHandler, NULL);
	CPhidget_set_OnError_Handler((CPhidgetHandle)ifKit, ErrorHandler, NULL);

	//Registers a callback that will run if an input changes.
	//Requires the handle for the Phidget, the function that will be called, and an arbitrary pointer that will be supplied to the callback function (may be NULL).
	CPhidgetInterfaceKit_set_OnInputChange_Handler (ifKit, InputChangeHandler, NULL);

	//Registers a callback that will run if the sensor value changes by more than the OnSensorChange trig-ger.
	//Requires the handle for the IntefaceKit, the function that will be called, and an arbitrary pointer that will be supplied to the callback function (may be NULL).
	CPhidgetInterfaceKit_set_OnSensorChange_Handler (ifKit, SensorChangeHandler, NULL);

	//Registers a callback that will run if an output changes.
	//Requires the handle for the Phidget, the function that will be called, and an arbitrary pointer that will be supplied to the callback function (may be NULL).
	CPhidgetInterfaceKit_set_OnOutputChange_Handler (ifKit, OutputChangeHandler, NULL);

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

	//get the program to wait for an accelerometer device to be attached
	printf("Waiting for interface kit to be attached....");
	if((result = CPhidget_waitForAttachment((CPhidgetHandle)ifKit, 10000)))
	{
		CPhidget_getErrorDescription(result, &err);
		printf("Problem waiting for attachment: %s\n", err);
		return 0;
	}

	//Display the properties of the attached accelerometer device
	display_properties(ifKit);

	//read interface kit event data
	printf("Reading.....\n");

	//keep displaying interface kit data until user input is read
	printf("Press any key to go to next step\n");
	getchar();

	printf("Modifying sensor sensitivity triggers....\n");

	//get the number of sensors available
	CPhidgetInterfaceKit_getNumSensors(ifKit, &numSensors);

	//Change the sensitivity trigger of the sensors
	for(i = 0; i < numSensors; i++)
	{
		CPhidgetInterfaceKit_setSensorChangeTrigger(ifKit, i, 100);  //we'll just use 10 for fun
	}

	//read interface kit event data
	printf("Reading.....\n");

	//keep displaying interface kit data until user input is read
	printf("Press any key to go to next step\n");
	getchar();

	printf("Toggling Ratiometric....\n");

	CPhidgetInterfaceKit_setRatiometric(ifKit, 0);

	//read interface kit event data
	printf("Reading.....\n");

	//keep displaying interface kit data until user input is read
	printf("Press any key to end\n");
	getchar();

	//since user input has been read, this is a signal to terminate the program so we will close the phidget and delete the object we created
	printf("Closing...\n");
	CPhidget_close((CPhidgetHandle)ifKit);
	CPhidget_delete((CPhidgetHandle)ifKit);

	//all done, exit
	return 0;
}

int main(int argc, char* argv[])
{
	interfacekit_simple();
	return 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产三级三级三级精品8ⅰ区| 性感美女久久精品| 久久久精品欧美丰满| 精品人伦一区二区色婷婷| 欧美剧情片在线观看| 欧美高清一级片在线| 3atv一区二区三区| 日韩女优视频免费观看| 欧美第一区第二区| 国产亚洲一区二区在线观看| 国产农村妇女精品| 亚洲欧洲精品一区二区三区不卡| 国产日韩欧美a| 亚洲色图视频网| 亚洲一区在线视频| 日本少妇一区二区| 老司机午夜精品| 成人av在线资源网| 日本电影欧美片| 欧美精品自拍偷拍| 久久久久99精品国产片| 亚洲日本在线视频观看| 性做久久久久久免费观看| 美女视频黄久久| www.久久久久久久久| 欧美色综合影院| 久久久久久久av麻豆果冻| 国产精品久久久久一区二区三区共| 亚洲免费资源在线播放| 蜜臀久久99精品久久久久宅男| 国产黄人亚洲片| 欧美网站大全在线观看| 国产女同互慰高潮91漫画| 亚洲国产日韩a在线播放| 精品伊人久久久久7777人| 成人不卡免费av| 日韩一级片在线观看| 中文字幕乱码亚洲精品一区| 丝袜a∨在线一区二区三区不卡 | 色婷婷精品久久二区二区蜜臀av| 欧美三日本三级三级在线播放| 精品国产乱码久久| 一区二区三区免费网站| 国产精品性做久久久久久| 欧美日韩亚洲丝袜制服| 国产欧美一区二区三区鸳鸯浴 | 韩国精品主播一区二区在线观看| 91同城在线观看| 久久久久久久久久久久电影| 日韩精品欧美精品| 在线视频综合导航| 国产精品高潮久久久久无| 美女网站一区二区| 9191久久久久久久久久久| 亚洲免费在线观看| 高清成人免费视频| 欧美精品一区二区在线观看| 天天色综合天天| 日本大香伊一区二区三区| 欧美激情一区三区| 精品亚洲国产成人av制服丝袜| 欧美日韩精品欧美日韩精品一 | 亚洲国产精品欧美一二99| k8久久久一区二区三区| 国产日韩欧美电影| 国产成a人亚洲| 精品国产免费一区二区三区香蕉| 日日夜夜精品视频免费| 欧美三级在线看| 亚洲福利一二三区| 色综合色狠狠综合色| 亚洲欧洲制服丝袜| 色先锋aa成人| 一区二区三区在线视频观看| 色八戒一区二区三区| 樱桃视频在线观看一区| 91首页免费视频| 一区二区视频在线| 欧美视频在线一区二区三区| 亚洲国产综合在线| 欧美日本在线视频| 青青草国产成人av片免费| 日韩欧美国产1| 国产二区国产一区在线观看| 欧美国产日产图区| 99视频精品免费视频| 亚洲激情图片qvod| 6080国产精品一区二区| 日韩成人一级片| 精品国产99国产精品| 国内精品久久久久影院一蜜桃| 国产午夜亚洲精品理论片色戒| 成人在线综合网| 亚洲精品伦理在线| 91精品国产综合久久精品性色| 蜜桃视频一区二区| 国产亚洲精品免费| 色屁屁一区二区| 美女一区二区视频| 亚洲欧美自拍偷拍| 7777精品伊人久久久大香线蕉| 精品一区二区在线观看| 中文字幕不卡在线观看| 欧美日韩一区视频| 国产一区二区中文字幕| 一区二区三区不卡在线观看 | 亚洲午夜精品在线| 日韩欧美精品在线视频| 99在线视频精品| 久久av资源站| 亚洲精品欧美专区| 久久久久久久久久美女| 欧美中文字幕亚洲一区二区va在线| 日本中文在线一区| 中文字幕制服丝袜一区二区三区| 欧美日韩黄视频| 成人黄动漫网站免费app| 婷婷国产v国产偷v亚洲高清| 日本一区二区视频在线观看| 欧美色电影在线| 91在线码无精品| 国产一区二区在线观看免费| 亚洲成人资源网| 国产精品国产自产拍高清av| 日韩欧美色电影| 777久久久精品| 欧美视频在线一区二区三区 | 蜜桃av一区二区三区电影| 亚洲久草在线视频| 国产蜜臀97一区二区三区| 日韩精品中文字幕在线一区| 欧美日精品一区视频| 9人人澡人人爽人人精品| 国产一区二区三区四区五区美女 | 丁香一区二区三区| 久久国产人妖系列| 日韩黄色小视频| 亚洲成在人线在线播放| 一区二区三区不卡视频在线观看| 国产精品免费视频网站| 久久人人97超碰com| 日韩免费视频一区| 51精品秘密在线观看| 欧美日韩亚洲综合| 欧美日韩国产一二三| 精品视频免费在线| 欧美天堂一区二区三区| 欧美性淫爽ww久久久久无| 色婷婷亚洲综合| 91免费观看国产| 日本道在线观看一区二区| 一本一道久久a久久精品综合蜜臀| 成人av免费在线观看| 成人97人人超碰人人99| 成人av免费在线| 在线观看日韩一区| 欧美亚洲综合网| 欧美日韩免费高清一区色橹橹 | 懂色av一区二区夜夜嗨| 国产91精品一区二区麻豆网站| 国产福利一区在线观看| 国产精品91xxx| av亚洲精华国产精华精| 日本韩国精品在线| 欧美日韩不卡在线| 日韩欧美中文字幕制服| 久久人人超碰精品| 综合久久久久久久| 视频在线观看91| 国产一区免费电影| 91丨九色丨蝌蚪富婆spa| 欧美四级电影在线观看| 欧美成va人片在线观看| 国产欧美精品国产国产专区| 1区2区3区欧美| 日韩综合小视频| 国产精品99久| 欧美色综合久久| 亚洲精品在线观看视频| 亚洲欧洲日韩综合一区二区| 亚洲精品乱码久久久久久久久 | 欧美精品久久天天躁| 欧美三级韩国三级日本一级| 欧美一区二区三区公司| 久久久久久久一区| 亚洲国产一二三| 黄色小说综合网站| 91在线精品一区二区三区| 91精品国模一区二区三区| 国产午夜亚洲精品不卡| 亚洲一卡二卡三卡四卡| 国产精选一区二区三区| 欧美日韩精品系列| 国产精品视频看| 蜜桃一区二区三区在线观看| 一本色道a无线码一区v| 26uuu精品一区二区| 亚洲1区2区3区4区| 91在线你懂得| 日本一区二区久久|