Created
December 12, 2011 16:27
-
-
Save nikuyoshi/1468092 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------- | |
#include <XnUSB.h> | |
enum | |
{ | |
VID_MICROSOFT = 0x45e, | |
PID_NUI_MOTOR = 0x02b0 | |
}; | |
XN_USB_DEV_HANDLE dev; | |
int main() { | |
int angle = 0; | |
const XnUSBConnectionString* pastrDevicePaths = NULL; | |
XnUInt32 nCount = 0; | |
XnUChar empty[1]; | |
xnUSBInit(); | |
xnUSBEnumerateDevices(VID_MICROSOFT, PID_NUI_MOTOR,&pastrDevicePaths,&nCount); | |
xnUSBOpenDeviceByPath(*pastrDevicePaths, &dev); | |
xnUSBSendControl | |
( | |
dev, | |
XN_USB_CONTROL_TYPE_VENDOR, | |
0x31,(XnUInt16)angle * 2, | |
0x0, empty, 0x0, 0 | |
); | |
xnUSBCloseDevice(dev); | |
xnUSBFreeDevicesList(pastrDevicePaths); | |
xnUSBShutdown(); | |
return 0; | |
} | |
//-------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment