attempt to fix posible power issues with the sharp

Dependencies:   ADS1115 BME280 CronoDot SDFileSystem mbed

Fork of Outdoor_UPAS_v1_2_Tboard by scott kelleher

Revision:
16:577cb22cec99
Parent:
15:e564c8031c47
Child:
17:3e6dda6e6335
--- a/main.cpp	Tue Mar 22 15:50:31 2016 +0000
+++ b/main.cpp	Tue Mar 22 18:08:12 2016 +0000
@@ -71,6 +71,7 @@
 /////////////////////////////////////////////
 //GPS
 /////////////////////////////////////////////
+DigitalOut      gpsEN(PB_15, 1);
 Max_M8 gps(PB_9, PB_8,(66<<1));   // this must be defnined in the int main (? Not sure if this is true)
 
 /////////////////////////////////////////////
@@ -445,9 +446,9 @@
     vInReading = ads.readADC_SingleEnded(1, 0xD583); // read channel 0
     vBlowerReading = ads.readADC_SingleEnded(2, 0xE783); // read channel 0
     omronDiff = ads.readADC_Differential(0x8583); // differential channel 2-3
-    /*    
+        
     gps.read(1);
-        
+        RGB_LED.set_led(1,1,0);
         gpsspeed = gps.speed;
         gpssatellites =  gps.satellites;
         gpslatitude = gps.lat;
@@ -456,7 +457,8 @@
        // gpslon = 'W'; //gps.lon; need to fix this (if statement?)
         gpsaltitude = gps.altitude;
         
-                    if (abs(gpslatitude) > 0 && abs(gpslongitude) > 0) {
+          /*  
+            if (abs(gpslatitude) > 0 && abs(gpslongitude) > 0) {
       
             if(gpslat == 'S')
               {
@@ -507,8 +509,8 @@
             //    digitalWrite (travel_red_led, HIGH);
                 location = 3;
               }
-
-     */
+*/
+     
     FILE *fp = fopen(filename, "a");
     //fprintf(fp, "%02d,%02d,%02d,%02d,%02d,%02d,",RTC_UPAS.year, RTC_UPAS.month,RTC_UPAS.date,RTC_UPAS.hour,RTC_UPAS.minutes,RTC_UPAS.seconds);
     fprintf(fp, "%s,", timestr);
@@ -516,8 +518,9 @@
     fprintf(fp, "%1.3f,%5.1f,%1.1f,%1.1f,%1.1f,%1.1f,", volflow, sampledVol, accel_x, accel_y, accel_z, accel_comp);
     fprintf(fp, "%.1f,%.1f,%.1f,%.3f,%.3f,%.3f,%.1f,", angle_x,angle_y,angle_z,mag_x, mag_y, mag_z,compass);
     fprintf(fp, "%d,%d,%d,%d,%d,%d," ,uv,omronReading, vInReading, vBlowerReading, omronDiff,gasG.getAmps());
-    fprintf(fp, "%d,%d,%d,%1.3f,%1.3f,\r\n", gasG.getVolts(), gasG.getCharge(),digital_pot_set, deltaMflow, deltaVflow);
-    //fprintf(fp, "%.4f,%.4f,%06d,%06d,%f,%d,%f,\r\n",  gps.lat, gps.lon, (long)gps.date, (long)gps.utc, gpsspeed, gpssatellites,  gpsaltitude); // test and add in speed, etc that Josh added in to match the adafruit GPS
+    fprintf(fp, "%d,%d,%d,%1.3f,%1.3f,", gasG.getVolts(), gasG.getCharge(),digital_pot_set, deltaMflow, deltaVflow);
+    //fprintf(fp, "%f,%f,%06d,%06d\r\n",  gps.lat, gps.lon, (long)gps.date, (long)gps.utc); // test and add in speed, etc that Josh added in to match the adafruit GPS
+    fprintf(fp, "%f,%f,%06d,%06d,%f,%d,%f\r\n",  gps.lat, gps.lon, (long)gps.date, (long)gps.utc, gpsspeed, gpssatellites,  gpsaltitude); // test and add in speed, etc that Josh added in to match the adafruit GPS
     fclose(fp);
     free(fp);
     RGB_LED.set_led(0,1,0);
@@ -598,16 +601,43 @@
     wait(5);
 
 /*
+motor1.getFault();
+    wait(5);
+    RGB_LED.set_led(0,0,0);
+motor2.getFault();
+    wait(5);
+    RGB_LED.set_led(1,0,0);
+motor3.getFault();
+    wait(5);
+    RGB_LED.set_led(0,0,0);
+motor4.getFault();
+    wait(5);
+    RGB_LED.set_led(1,0,0);
+
+    RGB_LED.set_led(1,0,0);
     motor1.drive(254); //closed = 253, open = 254
-    motor2.drive(253); //closed = 253, open = 254
-    motor3.drive(253); //closed = 253, open = 254
-    motor4.drive(253); //closed = 253, open = 254
-    
-    wait(1);
+        wait(10);
     motor1.stop();
+    RGB_LED.set_led(0,0,0);
+        
+
+    motor2.drive(254); //closed = 253, open = 254
+        wait(10);
     motor2.stop();
+    RGB_LED.set_led(1,0,0);
+
+    motor3.drive(254); //closed = 253, open = 254
+        wait(10);
     motor3.stop();
+    RGB_LED.set_led(0,0,0);
+
+
+    motor4.drive(254); //closed = 253, open = 254
+        wait(10);
     motor4.stop();
+    RGB_LED.set_led(0,0,1);
+
+
 
 
     pc.baud(115200);  // set what you want here depending on your terminal program speed