first publish

Dependencies:   BEAR_Protocol Debug Process QEI UI iSerial mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "Debug.h"
00002 #include "UI.h"
00003 #include "pinconfig.h"
00004 #include "BEAR_Protocol.h"
00005 
00006 DigitalIn button(USER_BUTTON);
00007 Serial pc(SERIAL_TX,SERIAL_RX);
00008 
00009 void DebugMode();
00010 
00011 int main()
00012 {
00013     if(!button) {
00014         while(!button);
00015         DebugMode(); //-->Debug.h
00016     }
00017     
00018     UI ui(SW_WALK1,SW_WALK2,SW_WALK3,SW_SWEEP,SW_WATER,EMERGENCY);
00019     
00020     pc.printf("System Start\n");
00021     while(1)
00022     {
00023         while(!ui.getEmergencyStatus()) {
00024             ui.RunSystem();
00025         }
00026     }
00027 }
00028 
00029 void DebugMode()
00030 {
00031     float temp;
00032     int option;
00033     bool first_time = true;
00034     Debug debug(SERIAL_TX,SERIAL_RX);
00035     do {
00036         debug.PrintListMode();
00037         option = debug.ScanInputData(1);
00038 
00039         if(option == 1) {
00040             do {
00041                 temp = debug.Mode1();
00042                 debug.PrintAll(temp);
00043             } while(temp!=9999);
00044         }
00045 
00046         else if(option == 2) {
00047             do {
00048                 if(first_time==false) {
00049                     temp = debug.Mode2();
00050                     debug.PrintAll(temp);
00051                 } else {
00052                     temp = debug.Mode2();
00053                     if(temp!=0) first_time = false;
00054                 }
00055 
00056                 if(temp==9999) first_time = true;
00057             } while(temp!=9999);
00058         }
00059 
00060 
00061         debug.setChange();
00062     } while(option!=9999);
00063 }