#include <iostream>#include <fstream>#include "irobot-create.hh"

Functions | |
| int | main (int argc, char **argv) |
| int main | ( | int | argc, | |
| char ** | argv | |||
| ) |
This test program can be used to test direct communication to iRobot Create through a file (like the rfcomm layer or the serial port). No communication specific operation is done by this example, the file should be ready for communication before launching this binary.
00032 { 00033 if (argc != 2) 00034 { 00035 std::cout << "Usage: " << argv[0] << " <device>" << std::endl; 00036 std::cout << "The device argument may be /dev/ttyS0 or /dev/rfcomm0." 00037 << std::endl; 00038 return 1; 00039 } 00040 std::fstream stream (argv[1]); 00041 if (!stream.good ()) 00042 { 00043 std::cerr << "Failed to open ``" << argv[1] << "''." << std::endl; 00044 return 2; 00045 } 00046 00047 std::cout << "Create instance..." << std::endl; 00048 iRobot::Create robot (stream); 00049 00050 std::cout << "Send start command..." << std::endl; 00051 robot.sendStartCommand (); 00052 00053 std::cout << "Send demo command (1)..." << std::endl; 00054 robot.sendDemoCommand (iRobot::Create::DEMO_COVER); 00055 return 0; 00056 }
1.5.4