-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex_4_3_3.cpp
More file actions
28 lines (22 loc) · 727 Bytes
/
Copy pathex_4_3_3.cpp
File metadata and controls
28 lines (22 loc) · 727 Bytes
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
#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;
leftRight=false;
TexBot bot;
while(ros::ok()) {
if (bot.readButton()==0) {bot.lcd1 ("no button is being pressed");}
else if (bot.readButton()==1) {bot.lcd1 ("Button 1 pressed");}
else if (bot.readButton()==2) {bot.lcd1 ("Button 2 is pressed");}
else if (bot.readButton()==3) {bot.lcd1 ("Button 3 is pressed");
if (leftRight==false) {leftRight=true;}
else {leftRight=false;}
}
if (leftRight==false) {bot.lcd2 ("Left");}
if (leftRight==true) {bot.lcd2 ("Right");}
ros::spinOnce();
}
return 0;
}