The subsystem design/basis for the final project

Dependencies:   mbed-rtos mbed-src pixylib

Committer:
balsamfir
Date:
Mon Apr 24 21:37:50 2017 +0000
Revision:
19:05b8123905fb
Parent:
18:501f1007a572
Commit before share

Who changed what in which revision?

UserRevisionLine numberNew contents of line
balsamfir 2:2bc519e14bae 1 // Includes
balsamfir 2:2bc519e14bae 2 // ----------------------------------------------------------------
JamesMacLean 0:80a37292f6b2 3
balsamfir 2:2bc519e14bae 4 #include "global.h"
balsamfir 2:2bc519e14bae 5 #include "robot.h"
JamesMacLean 0:80a37292f6b2 6
balsamfir 19:05b8123905fb 7 void PrintMenu(void);
JamesMacLean 0:80a37292f6b2 8
balsamfir 2:2bc519e14bae 9 // Main Program
balsamfir 2:2bc519e14bae 10 // ----------------------------------------------------------------
balsamfir 2:2bc519e14bae 11 int main() {
balsamfir 3:dfb6733ae397 12 int mode;
balsamfir 15:caa5a93a31d7 13 InitRobot();
balsamfir 3:dfb6733ae397 14
JamesMacLean 0:80a37292f6b2 15 while (1) {
balsamfir 19:05b8123905fb 16 PrintMenu();
balsamfir 2:2bc519e14bae 17 mode = pc.getc();
balsamfir 3:dfb6733ae397 18 pc.printf("\r\n\r\n");
balsamfir 19:05b8123905fb 19 if (mode == 'a') {
balsamfir 18:501f1007a572 20 AutoTrack();
balsamfir 19:05b8123905fb 21 } else if (mode == 'm') {
balsamfir 18:501f1007a572 22 ManualControl();
balsamfir 19:05b8123905fb 23 } else if (mode == 't') {
balsamfir 18:501f1007a572 24 Tunning();
balsamfir 18:501f1007a572 25 } else {
balsamfir 18:501f1007a572 26 pc.printf("Error: Invalid Selection \r\n\r\n");
JamesMacLean 0:80a37292f6b2 27 }
balsamfir 3:dfb6733ae397 28 wait_ms(2000);
JamesMacLean 0:80a37292f6b2 29 }
JamesMacLean 0:80a37292f6b2 30 }
JamesMacLean 0:80a37292f6b2 31
balsamfir 2:2bc519e14bae 32 // Other Functions
balsamfir 2:2bc519e14bae 33 // ----------------------------------------------------------------
balsamfir 19:05b8123905fb 34 void PrintMenu(){
balsamfir 19:05b8123905fb 35 pc.printf("\e[1;1H\e[2J");
balsamfir 19:05b8123905fb 36 pc.printf("Select Mode: \r\n\r\n");
balsamfir 3:dfb6733ae397 37
balsamfir 19:05b8123905fb 38 pc.printf("---------------------------------------------------------------- \r\n");
balsamfir 19:05b8123905fb 39 pc.printf("a. Automated Tracking \r\n");
balsamfir 19:05b8123905fb 40 pc.printf("m. Manual Control \r\n");
balsamfir 19:05b8123905fb 41 pc.printf("t. System Tuning \r\n");
balsamfir 19:05b8123905fb 42 pc.printf("---------------------------------------------------------------- \r\n\r\n");
JamesMacLean 0:80a37292f6b2 43
balsamfir 19:05b8123905fb 44 pc.printf("=> ");
JamesMacLean 0:80a37292f6b2 45 }