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 bool enable_check_robot_led =
true;
64 bool enable_debris_led =
false;
65 bool enable_dock_led =
true;
66 bool enable_spot_led =
false;
67 uint8_t power_led = 0;
79 const int len = sprintf(digit_buffer,
"%d", power_led);
80 for (
int i = len; i < 4; i++) digit_buffer[i] =
' ';
81 robot.
setDigitsASCII(digit_buffer[0], digit_buffer[1], digit_buffer[2], digit_buffer[3]);
84 enable_check_robot_led = !enable_check_robot_led;
85 enable_debris_led = !enable_debris_led;
86 enable_dock_led = !enable_dock_led;
87 enable_spot_led = !enable_spot_led;
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 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.
bool setMode(const create::CreateMode &mode)
Change Create mode.