The subsystem design/basis for the final project
Dependencies: mbed-rtos mbed-src pixylib
Diff: main.cpp
- Revision:
- 3:dfb6733ae397
- Parent:
- 2:2bc519e14bae
- Child:
- 4:01252f56e0e5
diff -r 2bc519e14bae -r dfb6733ae397 main.cpp --- a/main.cpp Sun Mar 13 17:55:42 2016 +0000 +++ b/main.cpp Mon Mar 14 00:40:28 2016 +0000 @@ -10,17 +10,17 @@ // Definitions // ---------------------------------------------------------------- enum Mode { - AUTO_TRACK, - MANUAL_CONTROL, - PIXY_SUBSYSTEM, - MOTOR_RESPONSE, - SPEED_RESPONSE, - STEERING_RESPONSE, - TILT_RESPONSE, - MOTOR_TUNING, - SPEED_TUNING, - STEERING_TUNING, - TILT_TUNING + AUTO_TRACK = '0', + MANUAL_CONTROL = '1', + PIXY_SUBSYSTEM = '2', + MOTOR_RESPONSE = '3', + SPEED_RESPONSE = '4', + STEERING_RESPONSE = '5', + TILT_RESPONSE = '6', + MOTOR_TUNING = '7', + SPEED_TUNING = '8', + STEERING_TUNING = '9', + TILT_TUNING = 'a' }; void PrintMenu(Serial *pc); @@ -38,10 +38,12 @@ // Main Program // ---------------------------------------------------------------- int main() { - char mode; + int mode; + while (1) { PrintMenu(&pc); mode = pc.getc(); + pc.printf("\r\n\r\n"); switch (mode) { case AUTO_TRACK: AutoTrack(); @@ -74,20 +76,22 @@ SteeringTuning(); break; case TILT_TUNING: - TiltTuning(); + TiltTuning(); break; default: - pc.printf("\r\n\r\n Error: Invalid Selection \r\n\r\n"); - wait_ms(2000); + pc.printf("Error: Invalid Selection \r\n\r\n"); break; } - PrintMenu(&pc); + 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"); @@ -96,10 +100,10 @@ pc->printf("4. Speed Response \r\n"); pc->printf("5. Steering Response \r\n"); pc->printf("6. Tilt Response \r\n"); - pc->printf("7. Tune Motor \r\n"); - pc->printf("8. Tune Speed \r\n"); - pc->printf("9. Tune Steering \r\n"); - pc->printf("a. Tune Tilt \r\n"); + pc->printf("7. Motor Tunning \r\n"); + pc->printf("8. Speed Tunning \r\n"); + pc->printf("9. Steeing Tunning \r\n"); + pc->printf("a. Tilit Tunning \r\n"); pc->printf("---------------------------------------------------------------- \r\n\r\n"); pc->printf("=> ");