
first commit
Diff: main.cpp
- Revision:
- 18:831c1e03d83e
- Parent:
- 17:d2c98ebda90b
- Child:
- 19:65fecaa2a387
--- a/main.cpp Tue Oct 26 19:10:13 2021 +0000 +++ b/main.cpp Tue Oct 26 22:56:10 2021 +0000 @@ -24,7 +24,10 @@ steering_control(); PI(); }; + +DigitalOut mm(PTC17); int main() { + mm=1; state_update(); //Delcare Onboard LED with blue color DigitalOut led_b(LED_BLUE); @@ -39,7 +42,7 @@ //Start the control systm using a Ticker object steering_control_ticker.attach(&steering_control, 0.02); motorLoop.attach(&PI,TI); - // fault_detector.attach(&fault_check, 0.02); + fault_detector.attach(&fault_check, 0.003); //bt.attach(&btReceive); // call landmark_counter wjen a landmark is detected @@ -73,7 +76,7 @@ */ //wait(0.5); //commented out the wait bc it slows down the fault_check, and it breaks the analogIn readings for the driving input //the driving input ticker is faster than the analog.read() function, so all analog.read() methods must be in the main loop - switch(current_state ){ + switch(current_state){ case STOP : bt.printf("\r\nCurrent state is stop"); break; case RUN: bt.printf("\r\nCurrent state is RUN"); break; case WAIT : bt.printf("\r\nCurrent state is WAIT"); break; @@ -86,7 +89,7 @@ } x = abs(acc.getAccX()); -pot1Voltage = pot1 * 3.3f; +//pot1Voltage = pot1 * 3.3f; //dutyCycleLeft = (pot1 * fullBatScalar); //dutyCycleRight = (pot1 * fullBatScalar); @@ -101,9 +104,9 @@ bt.printf(", %5.2f ", errorRight); bt.printf("ErrorArea: %1.2f ", errorAreaLeft); -bt.printf("Output: %1.2f ", controllerOutputLeft); +pc.printf("Output: %1.2f ", controllerOutputLeft); -bt.printf("Batt Voltage: %1.2f \n",avgCellVoltage); +pc.printf("Batt Voltage: %1.2f \n",avgCellVoltage); //setpointLeft = pot1; //setpointRight = pot1;