Code to control a Traxster robot using a Wimote and Android app
Fork of BlueUSB by
main.cpp
- Committer:
- aswild
- Date:
- 2014-04-28
- Revision:
- 1:accdaa84fe8d
- Parent:
- 0:606b230e5b4a
File content as of revision 1:accdaa84fe8d:
#include "mbed.h" #include "USBHost.h" #include "Utils.h" Serial pc(USBTX, USBRX); Serial rob(p13, p14); DigitalIn modeSw(p19); // because of wiring on the breadboard, these pins are connected to 5V or // ground (for the robot and BlueSMiRF connections) so configure them as inputs // to avoid shorting anything out DigitalIn di11(p11); DigitalIn di12(p12); DigitalIn di15(p15); DigitalIn di16(p16); extern DigitalOut led1, led2, led3, led4; Ticker failsafeTick; time_t lastReportTime; void failsafe() { time_t t = time(NULL); if (t > lastReportTime+1) { rob.puts("stop\r"); led3 = 1; } } void RunWiimote(); void RunAndroid(); int main() { modeSw.mode(PullDown); rob.baud(19200); set_time(9001); failsafeTick.attach(&failsafe, 0.1); printf("Vroom Vroom!\n"); if (modeSw) RunWiimote(); else RunAndroid(); }