35 int main(
int argc,
char** argv) {
38 std::string port =
"/dev/ttyUSB0";
40 if (argc > 1 && std::string(argv[1]) ==
"create1") {
43 std::cout <<
"Running driver for Create 1" << std::endl;
46 std::cout <<
"Running driver for Create 2" << std::endl;
54 std::cout <<
"Connected to robot" << std::endl;
56 std::cout <<
"Failed to connect to robot on port " << port.c_str() << std::endl;
63 std::cout << std::endl <<
"Press center 'Clean' button to disconnect and end program" << std::endl;
65 bool enable_check_robot_led =
true;
66 bool enable_debris_led =
false;
67 bool enable_dock_led =
true;
68 bool enable_spot_led =
false;
69 uint8_t power_led = 0;
81 const int len = sprintf(digit_buffer,
"%d", power_led);
82 for (
int i = len; i < 4; i++) digit_buffer[i] =
' ';
83 robot->
setDigitsASCII(digit_buffer[0], digit_buffer[1], digit_buffer[2], digit_buffer[3]);
86 enable_check_robot_led = !enable_check_robot_led;
87 enable_debris_led = !enable_debris_led;
88 enable_dock_led = !enable_dock_led;
89 enable_spot_led = !enable_spot_led;
95 std::cout << std::endl;
103 std::cout <<
"Bye!" << std::endl;
bool setDigitsASCII(const uint8_t &digit1, const uint8_t &digit2, const uint8_t &digit3, const uint8_t &digit4) const
Set the four 7-segment display digits from left to right with ASCII codes. Any code out side the acce...
static RobotModel CREATE_1
Compatible with Create 1 or Roomba 500 series.
bool enableDockLED(const bool &enable)
Set the green "dock" LED on/off.
bool setPowerLED(const uint8_t &power, const uint8_t &intensity=255)
Set the center power LED.
int main(int argc, char **argv)
bool enableCheckRobotLED(const bool &enable)
Set the orange "check Create" LED on/off.
bool enableSpotLED(const bool &enable)
Set the green "spot" LED on/off.
bool isCleanButtonPressed() const
Get state of 'clean' button ('play' button on Create 1).
bool enableDebrisLED(const bool &enable)
Set the blue "debris" LED on/off.
bool connect(const std::string &port, const int &baud)
Make a serial connection to Create.
static RobotModel CREATE_2
Compatible with Create 2 or Roomba 600 series and greater.
void disconnect()
Disconnect from serial.
bool setMode(const create::CreateMode &mode)
Change Create mode.