ManualControl

Dependencies:   TPixy-Interface

Fork of MbedOS_Robot by ECE4333 - 2018 - Ahmed & Brandon

main.cpp

Committer:
asobhy
Date:
2018-03-11
Revision:
17:1184df616383
Parent:
15:cf67f83d5409
Child:
18:db6d9fc1ebd0

File content as of revision 17:1184df616383:

/******************************************************************************/
// ECE4333
// LAB Partner 1:   Ahmed Sobhy - ID: 3594449
// LAB Partner 2:   Brandon Kingman - ID: 3470444
// Project:         Autonomous Robot Design
// Instructor:      Prof. Chris Diduch
/******************************************************************************/

#include "mbed.h"
#include "WatchdogThread.h"
#include "PiControlThread.h"
#include "ExternalInterruptThread.h"
#include "ui.h"
#include "CameraThread.h"
#include "motor_driver_l.h"
#include "motor_driver_r.h"

/******************************************************************************/



/*******************************************************************************
*                       ******** Main Thread ********
*******************************************************************************/
int main()    // This thread executes first upon reset or power-on.
{
    
    // displays msg on terminal
    displayStartupMsg();

    // Initialize and run the threads below:
    WatchdogThreadInit();
    //CameraThreadInit();
    PiControlThreadInit();
    ExternalInterruptThreadInit();   

    while(1)
    {
        // if robot goes crazy press 'r' to kill it
        if(killRobot == true)
        {
            osThreadTerminate(PiControlId);
            motorDriver_L_stop();
            motorDriver_R_stop(); 
        }
        
        consoleUI(); 
        Thread::wait(500); // Go to sleep for 500 ms  
    }
}