FSG / Mbed 2 deprecated 7_20_17_FSG_

Dependencies:   BCEmotor Battery_Linear_Actuator_ Controller_ IMU_code_ LTC1298_7_14 MODSERIAL PosVelFilter_7_14 System_ mbed

Fork of 7_14_17_FSG_working by Troy Holley

Revision:
2:c3cb3ea3c9fa
Parent:
0:381a84fad08b
Child:
3:1257a7d2eb3a
--- a/main.cpp	Fri Jun 09 17:36:25 2017 +0000
+++ b/main.cpp	Tue Jun 13 17:23:06 2017 +0000
@@ -32,6 +32,7 @@
 DigitalOut enab(p9);        // a/d converter enable
 
 AnalogIn   pressure_analog_in(A5); //Initialize pin20   (read is float value)
+AnalogIn   ain(p18);
 
 /* ************ These tickers work independent of any while loops ********** */
 Ticker IMU_ticker; //ticker for printing IMU //https://developer.mbed.org/handbook/Ticker
@@ -75,7 +76,7 @@
     hBridge().stop();
     //start up the system timer so the position velocity estimator has a time signal
     systemTime().start();
-    enab=1;
+    //enab=1;
     //setup and start the adc. This runs on a fixed interval and is interrupt driven
     adc().initialize();
     adc().start();
@@ -269,6 +270,12 @@
                 }
             
         }
+        else if ((5.0*ain.read())<1.0)
+        {
+            pc().printf("Hit the limit switch??\n");
+            hBridge().stop();
+        }
+    
         //string snaps
         else if (pvf().getVelocity() > 100)
         {