Spring 2014, ECE 4180 project, Georgia Institute of Technolgoy. This is the autonomous driver program for the Robotics Cat and Mouse program.
Dependencies: IMUfilter ADXL345_I2C mbed ITG3200 USBHost mbed-rtos
Diff: HumanPosition.h
- Revision:
- 3:0a6e4d139b86
- Parent:
- 1:dacf7db790f6
--- a/HumanPosition.h Wed Apr 30 05:55:41 2014 +0000 +++ b/HumanPosition.h Wed Apr 30 12:25:47 2014 +0000 @@ -101,6 +101,7 @@ void sendPosition(void const *) { + // temp variables int x = 0; int y = 0; char a = 0; @@ -112,31 +113,37 @@ x = (int) x_position; y = (int) y_position; - // send current xy position to cpu bot pc.printf("Sending: %d %d...\n\r", x, y); + + // break down x coordinate by byte a = x >> 24; b = x >> 16; c = x >> 8; d = x; - // pc.printf("\ta: %x b: %x\n\r", a, b); + + // put each byte on the buffer xbee.putc('x'); - xbee.putc(a); // send upper bits - xbee.putc(b); // send lower bits + xbee.putc(a); + xbee.putc(b); xbee.putc(c); xbee.putc(d); + // break down y coordinate by byte a = y >> 24; b = y >> 16; c = y >> 8; d = y; - //pc.printf("\ta: %x b: %x\n\r", a, b); + + // put each byte on the buffer xbee.putc('y'); - xbee.putc(a); // send upper bits - xbee.putc(b); // send lower bits + xbee.putc(a); + xbee.putc(b); xbee.putc(c); xbee.putc(d); pc.printf("Send complete.\n\r"); + + // wait for a possible game over response wait(0.25); if(xbee.readable() && xbee.getc() == 'd') { gameOver = true;