-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.m
60 lines (53 loc) · 1.33 KB
/
main.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
count = 0;
% brick.SetColorMode(3, 2);
initialDistance = brick.UltrasonicDist(4);
while true
brick.SetColorMode(3, 2);
color = brick.ColorCode(3);
disp("Got Color");
% Check for wall change
fxcode.detectWallChange(brick, initialDistance)
disp("Yes I did");
% if fxcode.detectWallChange(brick)
% count = count + 1;
% end
% Perform actions based on color
% color = brick.ColorCode(3);
disp(color);
if color == 5
fprintf('Stop Sign \n');
% brick.StopAllMotors('Brake');
end
if color == 4
fprintf('Lifting lift\n');
brick.StopAllMotors('Brake');
brick.MoveMotor('C', 100);
pause(2);
brick.StopAllMotors('Brake');
fprintf('Done Lifting\n');
end
if color == 3
fprintf('Finish\n');
brick.StopAllMotors('Brake');
end
% Lift.liftUp(brick);
% if color == 4
% fprintf('Lifting lift\n');
% brick.StopAllMotors('Brake');
% brick.MoveMotor('C', 250);
% pause(5);
% brick.StopAllMotors('Brake');
% fprintf('Done Lifting\n');
% end
%
% if color == 3
% fprintf('Finish\n');
% brick.StopAllMotors('Brake');
% end
%
% if color == 5
% brick.StopAllMotors('Brake');
% fprintf('yo')
% end
pause(1);
end