This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
#include <libirobot/SerialControl.h> |
| 2 |
#include "DriveRobot.h" |
| 3 |
#include <libirobot/Drive.h> |
| 4 |
DriveRobot *robot; |
| 5 |
|
| 6 |
#ifndef __AVR__ |
| 7 |
#include <error.h> |
| 8 |
#include <signal.h> |
| 9 |
#include <stdlib.h> |
| 10 |
|
| 11 |
void quit(int) |
| 12 |
{ |
| 13 |
Drive *d = robot->getDrive(); |
| 14 |
d->move(0); |
| 15 |
exit(0); |
| 16 |
} |
| 17 |
|
| 18 |
#endif |
| 19 |
|
| 20 |
int main ( int argc, char* argv[] ) |
| 21 |
{ |
| 22 |
#ifndef __AVR__ |
| 23 |
if (argc < 2) |
| 24 |
error(1, 0, "Usage: %s [serial-device]", argv[0]); |
| 25 |
#endif |
| 26 |
robot = new DriveRobot( argv[1] ); |
| 27 |
#ifndef __AVR__ |
| 28 |
struct sigaction handler; |
| 29 |
handler.sa_handler = quit; |
| 30 |
sigaction(SIGINT, &handler, 0); |
| 31 |
#endif |
| 32 |
return robot->run(); |
| 33 |
} |