forked from therandomfactory/speckle-control
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestwheel2.cpp
43 lines (31 loc) · 1.04 KB
/
testwheel2.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// g++ -c -g -I../include GenOneLinuxUSB.cpp -fpermissive
// g++ -g -o test2 testwheel2.cpp GenOneLinuxUSB.o -L../lib -I. -I../include ../lib/libusb-1.0.so.0 -lstdc++ -fpermissive
//
#include "string.h"
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include "GenOneLinuxUSB.h"
int main(int argc, char **argv)
{
char *result=(char *)malloc(128);
char *cmd=(char *)malloc(32);
int status;
unsigned int count=80;
GenOneLinuxUSB wheelA = GenOneLinuxUSB(2);
printf("Connected to wheel 2\n");
wheelA.write_cmd("STB?\n");
status=wheelA.read_result(result,count);
printf("result of STB? is %d, %s\n",status,result);
wheelA.write_cmd("IDN?\n");
status=wheelA.read_result(result,count);
printf("result of IDN? is %d, %s\n",status,result);
wheelA.write_cmd("FILT?\n");
status=wheelA.read_result(result,count);
printf("result of FILT? is %d, %s\n",status,result);
wheelA.write_cmd("NEXT\n");
status=wheelA.read_result(result,count);
printf("result of NEXT is %d, %s\n",status,result);
delete wheelA;
}