CSCI 5360 JB_MB_BC
/
m3pi_reciever
Executes commands received via xbee.
Diff: main.cpp
- Revision:
- 1:8b83b8a03351
- Parent:
- 0:98be52da5242
- Child:
- 2:ce95322fe535
--- a/main.cpp Sun Apr 19 16:01:27 2015 +0000 +++ b/main.cpp Tue Apr 21 15:48:31 2015 +0000 @@ -7,28 +7,30 @@ void execute(); void set_command(); +//once we're finished, these can go in a separate header file. const char LEFT = 'A'; const char RIGHT = 'B'; const char STOP = 'D'; const char FORWARD = 'E'; const char BACKWARD = 'F'; +const float EX_TIME = 1.0; char command; +char prev_command; //in case we need a command history float speed; int main() { - + prev_command = STOP; command = STOP; speed = 0.3; - m3pi.locate(0,1); - m3pi.printf("Hola"); + m3pi.cls(); while (1) { - set_command(); + //set_command(); m3pi.locate(0,1); - m3pi.printf("%c",command); - execute(); - //wait(1); + m3pi.printf("%f", m3pi.battery()); + //m3pi.printf("%c",command); + //execute(); } } @@ -49,7 +51,8 @@ void set_command() { if (xbee.readable()) { + prev_command = command; command = xbee.getc(); - wait(1); + wait(EX_TIME); } } \ No newline at end of file