forked from samuellab/mindcontrol
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtestStage.c
More file actions
50 lines (35 loc) · 766 Bytes
/
testStage.c
File metadata and controls
50 lines (35 loc) · 766 Bytes
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
42
43
44
45
46
47
48
49
50
#include <stdio.h>
#include <math.h>
#include <windows.h>
#include "MyLibs/Talk2Stage.h"
int main(){
printf("Testing the Ludl stage.\nWait\n");
HANDLE stage=InitializeUsbStage();
int k=1;
int key=0;
float x;
float y;
float t;
int commandInterval=10;
printf("Sending commands with %d ms interval\n",commandInterval);
while (1) {
Sleep(commandInterval);
t=(float) k;
//Generate circle in velocity space
x=1000*sin(t/300);
y=1000*cos(t/300);
// Convert floats to int
int vx, vy;
vx=(int) x;
vy= (int) y;
//Send velocity command to stage
spinStage(stage,vx,vy);
if (k%100==0){
printf("\n%d commands sent",k);
printf(" current velocity: %d, %d\n",vx, vy);
}
printf(".");
k=k+1;
}
return 0;
}