v1
Dependencies: BEAR_Protocol_Edited BufferedSerial Debug MaxSonar PID Process QEI UI iSerial mbed
Fork of CleaningMachine_Betago by
Diff: main.cpp
- Revision:
- 0:84f05cd2f197
- Child:
- 1:45f1573d65a1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 15 17:48:23 2016 +0000 @@ -0,0 +1,63 @@ +#include "Debug.h" +#include "UI.h" +#include "pinconfig.h" +#include "BEAR_Protocol.h" + +DigitalIn button(USER_BUTTON); +Serial pc(SERIAL_TX,SERIAL_RX); + +void DebugMode(); + +int main() +{ + if(!button) { + while(!button); + DebugMode(); //-->Debug.h + } + + UI ui(SW_WALK1,SW_WALK2,SW_WALK3,SW_SWEEP,SW_WATER,EMERGENCY); + + pc.printf("System Start\n"); + while(1) + { + while(!ui.getEmergencyStatus()) { + ui.RunSystem(); + } + } +} + +void DebugMode() +{ + float temp; + int option; + bool first_time = true; + Debug debug(SERIAL_TX,SERIAL_RX); + do { + debug.PrintListMode(); + option = debug.ScanInputData(1); + + if(option == 1) { + do { + temp = debug.Mode1(); + debug.PrintAll(temp); + } while(temp!=9999); + } + + else if(option == 2) { + do { + if(first_time==false) { + temp = debug.Mode2(); + debug.PrintAll(temp); + } else { + temp = debug.Mode2(); + if(temp!=0) first_time = false; + } + + if(temp==9999) first_time = true; + } while(temp!=9999); + } + + + debug.setChange(); + } while(option!=9999); +} \ No newline at end of file