-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJellibiPin.cpp
More file actions
99 lines (87 loc) · 2.06 KB
/
Copy pathJellibiPin.cpp
File metadata and controls
99 lines (87 loc) · 2.06 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
92
93
94
95
96
97
98
#include <JellibiPin.h>
#define WARN() if(Serial) {Serial.print("Warning : Not Available Pos");Serial.println(__FUNCTION__);}
JellibiPin::JellibiPin()
{
}
const int JellibiPin::Button(JellibiPos pos)
{
if (pos == U) {
return JellibiPin::BUTTON_UP;
} else if (pos == D) {
return JellibiPin::BUTTON_DOWN;
} else if (pos == R) {
return JellibiPin::BUTTON_RIGHT;
} else if (pos == L) {
return JellibiPin::BUTTON_LEFT;
} else {
WARN();
return JellibiPin::NONE;
}
}
const int JellibiPin::Wheel(JellibiPos pos)
{
if (pos == R) {
return JellibiPin::WHEEL_PWM_RIGHT;
} else if (pos == L) {
return JellibiPin::WHEEL_PWM_LEFT;
} else {
WARN();
return JellibiPin::NONE;
}
}
const int JellibiPin::WheelDir(JellibiPos pos)
{
if (pos == R) {
return JellibiPin::WHEEL_DIR_RIGHT;
} else if (pos == L) {
return JellibiPin::WHEEL_DIR_LEFT;
} else {
WARN();
return JellibiPin::NONE;
}
}
const int JellibiPin::Servo(JellibiPos pos)
{
if (pos == R) {
return JellibiPin::SERVO_GRIP;
} else if (pos == L) {
return JellibiPin::SERVO_LIFT;
} else {
WARN();
return JellibiPin::NONE;
}
}
const int JellibiPin::Ir(JellibiPos pos)
{
if (pos == R) {
return JellibiPin::IR_RIGHT;
} else if (pos == L) {
return JellibiPin::IR_LEFT;
} else if (pos == C) {
return JellibiPin::IR_CENTER;
} else {
WARN();
return JellibiPin::NONE;
}
}
const int JellibiPin::Led(JellibiPos pos)
{
if (pos == L) {
return JellibiPin::LED_LEFT;
} else if (pos == R) {
return JellibiPin::LED_RIGHT;
} else if (pos == C) {
return JellibiPin::LED_STATUS;
} else {
WARN();
return JellibiPin::NONE;
}
}
const int JellibiPin::Cds()
{
return JellibiPin::CDS_SENSOR;
}
const int JellibiPin::Buzzer()
{
return JellibiPin::BUZZER;
}