-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcamera_variable_can_change
More file actions
91 lines (75 loc) · 1.77 KB
/
Copy pathcamera_variable_can_change
File metadata and controls
91 lines (75 loc) · 1.77 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
void camera_back(int Hmax, int Hmin, int Smax, int Smin, int x1, int s1, int x2, int s2) { //yellow
// int Hmax = 100;
// int Hmin = 45;
// int Smax = 75;
// int Smin = 23;
//x1 = 160, s1 = 500, x2 = 240, s2 = 200
MFCapSetH(Hmax,Hmin);
MFCapSetS(Smax,Smin);
move_back(1023, 100);
stop();
turn_head('r');
set_posture(-40, 50, 45, 50, 500);
while (1) {
if (X() < x1) LED('l');
if (color_block() > s1) LED('r');
if (X() < x1 && color_block() > s1) {
LED('b');
stop();
break;
} else {
move_back(400, 50);
}
}
while (1) {
if (X() < x2)
LED('l');
else if (color_block() > s2)
LED('r');
if (X() < x2 && color_block() > s2) {
LED('b');
stop();
break;
} else {
turn_right_slowly_2(100);
}
}
stop();
}
void camera(int Hmax, int Hmin, int Smax, int Smin, int x1, int s1, int x2, int s2) { //green
//Hmax=180, Hmin=116, Smax=120, Smin=70
//x1 = 160, s1 = 500, x2 = 320, s2 = 200
MFCapSetH(Hmax,Hmin);
MFCapSetS(Smax,Smin);
move_forward(1023, 4000);
stop();
turn_head('r');
set_posture(-40, 50, 45, 50, 500);
while (1) {
if (X() > x1) LED('l');
if (color_block() > s1) LED('r');
if (X() > x1 && color_block() > s1) {
LED('b');
stop();
break;
} else {
move_forward(400, 50);
}
}
stop();
turn_head('m');
while (1) {
if (X() < x2)
LED('l');
else if (color_block() > s2)
LED('r');
if (X() < x2 && color_block() > s2) {
LED('b');
stop();
break;
} else {
turn_right_slowly_2(100);
}
}
stop();
}