-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKemaState.cpp
135 lines (106 loc) · 1.7 KB
/
KemaState.cpp
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// (c) https://vk.com/myrobotics
#include "Arduino.h"
#include "KemaState.h"
KemaState::KemaState()
{
_speed = 0;
_turn_ang = 0;
_echo_right = 0;
_echo_left = 0;
_echo_left = 0;
_ir_left = 1;
_ir_right = 1;
_crash_left = 0;
_crash_right = 0;
_sens_speed = 0;
_action = 'S';
_led = '?';
}
int KemaState::speed()
{
return _speed;
}
int KemaState::turnAng()
{
return _turn_ang;
}
int KemaState::echoR()
{
return _echo_right;
}
int KemaState::echoL()
{
return _echo_left;
}
char KemaState::act()
{
return _action;
}
char KemaState::led()
{
return _led;
}
int KemaState::irL()
{
return _ir_left;
}
int KemaState::irR()
{
return _ir_right;
}
int KemaState::crashL()
{
return _crash_left;
}
int KemaState::crashR()
{
return _crash_right;
}
int KemaState::sensSpeed()
{
return _sens_speed;
}
void KemaState::setSpeed(int speed)
{
_speed = speed;
}
void KemaState::setTurnAng(int turn_ang)
{
_turn_ang = turn_ang;
}
void KemaState::setEchoR(int echo_right)
{
_echo_right = echo_right;
}
void KemaState::setEchoL(int echo_left)
{
_echo_left = echo_left;
}
void KemaState::setAct(char action)
{
_action = action;
}
void KemaState::setLed(char led)
{
_led = led;
}
void KemaState::setIRL(int ir_left)
{
_ir_left = ir_left;
}
void KemaState::setIRR(int ir_right)
{
_ir_right = ir_right;
}
void KemaState::setCrashL(int crash_left)
{
_crash_left = crash_left;
}
void KemaState::setCrashR(int crash_right)
{
_crash_right = crash_right;
}
void KemaState::setSensSpeed(int speed)
{
_sens_speed = speed;
}