-
Notifications
You must be signed in to change notification settings - Fork 2
/
milestone1
41 lines (40 loc) · 1.12 KB
/
milestone1
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
3/13/24 - Implementation of transportaion with connection to comupter remotely
Code: global key
InitKeyboard();
while 1
brick.SetColorMode(3, 2);
color = brick.ColorCode(3);
display(color);
pause(0.1);
switch key
case 'uparrow'
disp('Up Arrow Pressed!');
brick.MoveMotor('A', 100);
brick.MoveMotor('D', 100);
case 'downarrow'
disp('Down Arrow Pressed!');
brick.MoveMotor('A', -100);
brick.MoveMotor('D', -100);
case 'leftarrow'
disp('Left Arrow Pressed!');
brick.MoveMotor('A', 100);
case 'rightarrow'
disp('Right Arrow Pressed');
brick.MoveMotor('D', 100);
case 'space'
disp('Space Pressed!');
brick.MoveMotor('C', 50);
case 'a'
disp('Space Pressed!');
brick.MoveMotor('C', -50);
case 0
disp('No Key Pressed!');
brick.StopMotor('A');
brick.StopMotor('B');
brick.StopMotor('C');
brick.StopMotor('D');
case 'q'
break;
end
end
CloseKeyboard();