-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex_4_3_5.cpp
More file actions
56 lines (49 loc) · 1.08 KB
/
Copy pathex_4_3_5.cpp
File metadata and controls
56 lines (49 loc) · 1.08 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
#include <ros/ros.h>
#include <unistd.h>
#include "texas_robotics_academy/texbot_wrapper.h"
int main(int argc, char **argv) {
ros::init(argc, argv, "robot");
bool leftRight;
bool threePressed;
int leftVal;
int rightVal;
rightVal=0;
leftVal=0;
threePressed=false;
leftRight=false;
TexBot bot;
while(ros::ok()) {
bot.lcd1(leftVal, " ", rightVal);
if (bot.readButton()==1) {
threePressed=false;
if (leftRight==false) {
leftVal++;
}
else if (leftRight==true) {
rightVal++;
}
}
else if (bot.readButton()==2) {
threePressed=false;
if (leftRight==false) {
leftVal--;
}
else if (leftRight==true) {
rightVal--;
}
}
//else if (bot.readButton()==2) {
//threePressed=false;
//}
else if (bot.readButton()==3) {
if (threePressed==false) {
threePressed==true;
leftRight=!leftRight;
}
}
if (leftRight==false) {bot.lcd2 ("Left");}
if (leftRight==true) {bot.lcd2 ("Right");}
ros::spinOnce();
}
return 0;
}