00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <c++/MotorPair.H>
00017 #include <c++/Sound.H>
00018 #include <conio.h>
00019 #include <unistd.h>
00020 #include <tm.h>
00021
00022
00023
00024
00025
00026
00027
00028 #if defined(CONF_DMOTOR)
00029
00030 int
00031 main(int argc,
00032 char **argv)
00033 {
00034 MotorPair m(Motor::A, Motor::C);
00035
00036 for (int i = 0; i < 10 && !shutdown_requested(); ++i) {
00037 if (i % 2) {
00038 m.forward();
00039 #ifdef CONF_DSOUND
00040 Sound::beep();
00041 #endif // CONF_DSOUND
00042 cputs ("FWD");
00043 } else {
00044 m.reverse();
00045 cputs ("REV");
00046 }
00047 m.speed(m.max);
00048 sleep(5);
00049 }
00050 m.off();
00051 cls();
00052
00053 return 0;
00054 }
00055 #else
00056 #warning rover.C requires CONF_DMOTOR
00057 #warning rover demo will do nothing
00058 int main(int argc, char *argv[]) {
00059 return 0;
00060 }
00061 #endif // CONF_DMOTOR