Zachary Sunberg / Mbed 2 deprecated SAILORSbot

Dependencies:   mbed

Committer:
zsunberg
Date:
Thu Jun 25 00:10:50 2015 +0000
Revision:
0:9f058fe8cab5
Child:
1:a7aab5937375
before erasing old led stuff

Who changed what in which revision?

UserRevisionLine numberNew contents of line
zsunberg 0:9f058fe8cab5 1 #include "robot.h"
zsunberg 0:9f058fe8cab5 2 #include <string>
zsunberg 0:9f058fe8cab5 3
zsunberg 0:9f058fe8cab5 4 std::string command;
zsunberg 0:9f058fe8cab5 5
zsunberg 0:9f058fe8cab5 6 void Rx_interrupt()
zsunberg 0:9f058fe8cab5 7 {
zsunberg 0:9f058fe8cab5 8 led2 = 1;
zsunberg 0:9f058fe8cab5 9 char readChar;
zsunberg 0:9f058fe8cab5 10 int res = 1;
zsunberg 0:9f058fe8cab5 11
zsunberg 0:9f058fe8cab5 12 command.clear()
zsunberg 0:9f058fe8cab5 13
zsunberg 0:9f058fe8cab5 14 while(xbee.readable()){
zsunberg 0:9f058fe8cab5 15 res = xbee.scanf("%c", &readChar);
zsunberg 0:9f058fe8cab5 16 if(res > 0){
zsunberg 0:9f058fe8cab5 17 led3 = 1;
zsunberg 0:9f058fe8cab5 18 xbee.printf("got %c", readChar);
zsunberg 0:9f058fe8cab5 19 } else {
zsunberg 0:9f058fe8cab5 20 led4 = 1;
zsunberg 0:9f058fe8cab5 21 }
zsunberg 0:9f058fe8cab5 22 }
zsunberg 0:9f058fe8cab5 23
zsunberg 0:9f058fe8cab5 24
zsunberg 0:9f058fe8cab5 25 /*
zsunberg 0:9f058fe8cab5 26 if(xbee.readable()){
zsunberg 0:9f058fe8cab5 27 // res = xbee.scanf("%f",
zsunberg 0:9f058fe8cab5 28 readChar = xbee.getc();
zsunberg 0:9f058fe8cab5 29 if(readChar == 'y'){
zsunberg 0:9f058fe8cab5 30 led3 = 1;
zsunberg 0:9f058fe8cab5 31 led4 = 0;
zsunberg 0:9f058fe8cab5 32 xbee.printf("y");
zsunberg 0:9f058fe8cab5 33 }
zsunberg 0:9f058fe8cab5 34 else if(readChar == 'n'){
zsunberg 0:9f058fe8cab5 35 led3 = 0;
zsunberg 0:9f058fe8cab5 36 led4 = 1;
zsunberg 0:9f058fe8cab5 37 xbee.printf("n");
zsunberg 0:9f058fe8cab5 38 }
zsunberg 0:9f058fe8cab5 39 }
zsunberg 0:9f058fe8cab5 40 */
zsunberg 0:9f058fe8cab5 41 return;
zsunberg 0:9f058fe8cab5 42 }
zsunberg 0:9f058fe8cab5 43
zsunberg 0:9f058fe8cab5 44 int parse_command(const std::string & cmd)
zsunberg 0:9f058fe8cab5 45 {
zsunberg 0:9f058fe8cab5 46
zsunberg 0:9f058fe8cab5 47 }
zsunberg 0:9f058fe8cab5 48
zsunberg 0:9f058fe8cab5 49 int main() {
zsunberg 0:9f058fe8cab5 50
zsunberg 0:9f058fe8cab5 51 xbee.attach(&Rx_interrupt, Serial::RxIrq);
zsunberg 0:9f058fe8cab5 52 xbeeReset = 0;
zsunberg 0:9f058fe8cab5 53 wait(2);
zsunberg 0:9f058fe8cab5 54 xbeeReset = 1;
zsunberg 0:9f058fe8cab5 55
zsunberg 0:9f058fe8cab5 56 while(1){
zsunberg 0:9f058fe8cab5 57 led2 = 0;
zsunberg 0:9f058fe8cab5 58 led1 = 1;
zsunberg 0:9f058fe8cab5 59 wait(0.2);
zsunberg 0:9f058fe8cab5 60 led1 = 0;
zsunberg 0:9f058fe8cab5 61 wait(0.2);
zsunberg 0:9f058fe8cab5 62 }
zsunberg 0:9f058fe8cab5 63
zsunberg 0:9f058fe8cab5 64 return 0;
zsunberg 0:9f058fe8cab5 65 }