-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrt.m
43 lines (41 loc) · 1007 Bytes
/
rt.m
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
function rt(a)
global rtflag;
rot = a*4
%Connection and motor assigning
%mylego = legoev3('bt','00165344463c');
%mylego = legoev3('Bluetooth', 'COM3');
mylego = legoev3('USB')
m1 = motor(mylego, 'A');
m2 = motor(mylego, 'B');
%mysensor = gyroSensor(mylego, 1);
%angle = readRotationAngle(mysensor);
%resetRotationAngle(mysensor);
%speed assigning
SPEED1 = 20;
SPEED2 = -10;
wb = 12;
wd = 5.5;
%motor init
m1.Speed = SPEED1;
m2.Speed = SPEED2;
resetRotation(m1);
resetRotation(m2);
rotd = ((wb/wd)*(a/360))*360;
a1 = readRotation(m1)
a2 = readRotation(m2);
%motor loop
while (a1<(rot-35)) %&& a2>(-rotd+5)
%a = readRotationAngle(mysensor);
%a1 = readRotation(m1)
%a2 = readRotation(m2);
a1 = readRotation(m1);
start(m1);
%start(m2);
a1 = readRotation(m1);
%a2 = readRotation(m2);
%a = readRotationAngle(mysensor);
end
stop(m1);
rtflag = a;
%stop(m2);
end