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
GameCode.h@1:dacf7db790f6, 2014-04-30 (annotated)
- Committer:
- Strikewolf
- Date:
- Wed Apr 30 05:54:17 2014 +0000
- Revision:
- 1:dacf7db790f6
- Child:
- 3:0a6e4d139b86
works without any motors
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Strikewolf | 1:dacf7db790f6 | 1 | #define THRESHOLD 100 |
Strikewolf | 1:dacf7db790f6 | 2 | |
Strikewolf | 1:dacf7db790f6 | 3 | Serial pc(USBTX, USBRX); |
Strikewolf | 1:dacf7db790f6 | 4 | |
Strikewolf | 1:dacf7db790f6 | 5 | bool gameOver = false; |
Strikewolf | 1:dacf7db790f6 | 6 | |
Strikewolf | 1:dacf7db790f6 | 7 | bool isGameOver(short x_hum, short y_hum, short x_cpu, short y_cpu) |
Strikewolf | 1:dacf7db790f6 | 8 | { |
Strikewolf | 1:dacf7db790f6 | 9 | if(abs(x_hum - x_cpu) < THRESHOLD && abs(y_hum - y_cpu) < THRESHOLD) { |
Strikewolf | 1:dacf7db790f6 | 10 | return true; |
Strikewolf | 1:dacf7db790f6 | 11 | } else { |
Strikewolf | 1:dacf7db790f6 | 12 | return false; |
Strikewolf | 1:dacf7db790f6 | 13 | } |
Strikewolf | 1:dacf7db790f6 | 14 | } |
Strikewolf | 1:dacf7db790f6 | 15 | |
Strikewolf | 1:dacf7db790f6 | 16 | void endGame() |
Strikewolf | 1:dacf7db790f6 | 17 | { |
Strikewolf | 1:dacf7db790f6 | 18 | pc.printf("GAME OVER\n\r"); |
Strikewolf | 1:dacf7db790f6 | 19 | exit(1); |
Strikewolf | 1:dacf7db790f6 | 20 | } |