Skip to content

Instantly share code, notes, and snippets.

@nikuyoshi
Created December 12, 2011 16:27
Show Gist options
  • Save nikuyoshi/1468092 to your computer and use it in GitHub Desktop.
Save nikuyoshi/1468092 to your computer and use it in GitHub Desktop.
//--------------------------------------
#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