ObjectFollower
Dependencies: TPixy-Interface
Fork of PlayBack by
main.cpp@17:1184df616383, 2018-03-11 (annotated)
- Committer:
- asobhy
- Date:
- Sun Mar 11 01:26:23 2018 +0000
- Revision:
- 17:1184df616383
- Parent:
- 15:cf67f83d5409
- Child:
- 18:db6d9fc1ebd0
MANUAL CONTROL - TESTING AND TUNNING REQUIRED
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
asobhy | 8:a0890fa79084 | 1 | /******************************************************************************/ |
asobhy | 0:a355e511bc5d | 2 | // ECE4333 |
asobhy | 9:fe56b888985c | 3 | // LAB Partner 1: Ahmed Sobhy - ID: 3594449 |
asobhy | 9:fe56b888985c | 4 | // LAB Partner 2: Brandon Kingman - ID: 3470444 |
asobhy | 9:fe56b888985c | 5 | // Project: Autonomous Robot Design |
asobhy | 9:fe56b888985c | 6 | // Instructor: Prof. Chris Diduch |
asobhy | 8:a0890fa79084 | 7 | /******************************************************************************/ |
asobhy | 0:a355e511bc5d | 8 | |
asobhy | 0:a355e511bc5d | 9 | #include "mbed.h" |
asobhy | 0:a355e511bc5d | 10 | #include "WatchdogThread.h" |
asobhy | 0:a355e511bc5d | 11 | #include "PiControlThread.h" |
asobhy | 0:a355e511bc5d | 12 | #include "ExternalInterruptThread.h" |
asobhy | 0:a355e511bc5d | 13 | #include "ui.h" |
asobhy | 10:8919b1b76243 | 14 | #include "CameraThread.h" |
asobhy | 15:cf67f83d5409 | 15 | #include "motor_driver_l.h" |
asobhy | 15:cf67f83d5409 | 16 | #include "motor_driver_r.h" |
asobhy | 0:a355e511bc5d | 17 | |
asobhy | 0:a355e511bc5d | 18 | /******************************************************************************/ |
asobhy | 0:a355e511bc5d | 19 | |
asobhy | 0:a355e511bc5d | 20 | |
asobhy | 0:a355e511bc5d | 21 | |
asobhy | 0:a355e511bc5d | 22 | /******************************************************************************* |
asobhy | 0:a355e511bc5d | 23 | * ******** Main Thread ******** |
asobhy | 0:a355e511bc5d | 24 | *******************************************************************************/ |
asobhy | 0:a355e511bc5d | 25 | int main() // This thread executes first upon reset or power-on. |
asobhy | 0:a355e511bc5d | 26 | { |
asobhy | 0:a355e511bc5d | 27 | |
asobhy | 0:a355e511bc5d | 28 | // displays msg on terminal |
asobhy | 0:a355e511bc5d | 29 | displayStartupMsg(); |
asobhy | 0:a355e511bc5d | 30 | |
asobhy | 0:a355e511bc5d | 31 | // Initialize and run the threads below: |
asobhy | 0:a355e511bc5d | 32 | WatchdogThreadInit(); |
asobhy | 17:1184df616383 | 33 | //CameraThreadInit(); |
asobhy | 0:a355e511bc5d | 34 | PiControlThreadInit(); |
asobhy | 0:a355e511bc5d | 35 | ExternalInterruptThreadInit(); |
asobhy | 0:a355e511bc5d | 36 | |
asobhy | 0:a355e511bc5d | 37 | while(1) |
asobhy | 0:a355e511bc5d | 38 | { |
asobhy | 15:cf67f83d5409 | 39 | // if robot goes crazy press 'r' to kill it |
asobhy | 15:cf67f83d5409 | 40 | if(killRobot == true) |
asobhy | 15:cf67f83d5409 | 41 | { |
asobhy | 15:cf67f83d5409 | 42 | osThreadTerminate(PiControlId); |
asobhy | 15:cf67f83d5409 | 43 | motorDriver_L_stop(); |
asobhy | 15:cf67f83d5409 | 44 | motorDriver_R_stop(); |
asobhy | 15:cf67f83d5409 | 45 | } |
asobhy | 15:cf67f83d5409 | 46 | |
asobhy | 11:9135e5bc2fcf | 47 | consoleUI(); |
asobhy | 0:a355e511bc5d | 48 | Thread::wait(500); // Go to sleep for 500 ms |
asobhy | 0:a355e511bc5d | 49 | } |
asobhy | 0:a355e511bc5d | 50 | } |