The subsystem design/basis for the final project

Dependencies:   mbed-rtos mbed-src pixylib

main.cpp

Committer:
balsamfir
Date:
2016-04-07
Revision:
18:501f1007a572
Parent:
17:47e107f9587b
Child:
19:05b8123905fb

File content as of revision 18:501f1007a572:

// Includes
// ----------------------------------------------------------------

#include "global.h"
#include "robot.h"

// Definitions 
// ----------------------------------------------------------------
enum Mode {
    AUTO_TRACK = '0', 
    MANUAL_CONTROL = '1', 
    SYSTEM_TUNING = '2'
};

void PrintMenu(Serial *pc);


// Wiring - TODO
// ----------------------------------------------------------------
//
//
//
//
//
//

// Main Program
// ----------------------------------------------------------------
int main() {  
    int mode;
    InitRobot();

    while (1) {
        PrintMenu(&pc);
        mode = pc.getc();
        pc.printf("\r\n\r\n");
        if ((mode == '0')||(mode == 'a')) {
            AutoTrack();
        } else if ((mode == '1')||(mode == 'm')) {
            ManualControl();
        } else if (mode == '2') {
            Tunning();
        } else {
            pc.printf("Error: Invalid Selection \r\n\r\n");
        }
        wait_ms(2000);
    }
}

// Other Functions
// ----------------------------------------------------------------
void PrintMenu(Serial *pc){
    pc->printf("\e[1;1H\e[2J");
    pc->printf("Select Mode: \r\n\r\n");
    
    pc->printf("---------------------------------------------------------------- \r\n");
    pc->printf("0. Automated Tracking \r\n");
    pc->printf("1. Manual Control \r\n");
     pc->printf("2. System Tuning \r\n");
    pc->printf("---------------------------------------------------------------- \r\n\r\n");
    
    pc->printf("=> ");
}