uses pushing box to write to google spreadsheets

Dependencies:   GSM_PUSHING_BOX_STATE_MACHINE MBed_Adafruit-GPS-Library SDFileSystem mbed

Fork of DCS by DCS_TEAM

Revision:
7:1c38181cb11f
Parent:
5:f0946f8ed23a
--- a/Sensor.cpp	Sun Mar 08 00:57:44 2015 +0000
+++ b/Sensor.cpp	Tue Mar 10 00:38:48 2015 +0000
@@ -6,10 +6,12 @@
 #include "QAM.h"
 #include "param.h"
 #include "GSMLibrary.h"
+#include <stdio.h>
+#include <stdlib.h>
 
 DigitalOut led_red(LED_RED);
 Serial pc(USBTX, USBRX);
-Serial gsm(PTC17,PTC16);
+Serial gsm(PTC3,PTC4);
 
 Timer t;
 
@@ -83,15 +85,17 @@
 int main () {
     
     pc.baud(115200);
-    gsm.baud(115200);
+    //gsm.baud(115200);
     
-    pc.printf("hello\r\n");
+    pc.printf("----------------------------------\r\n");
     
     //GSM INITIALIZATION ///////////////////////////////
-    gsm_initialize();
+    //gsm_initialize();
     // GPS INITIALIZATION //////////////////////////////
     Adafruit_GPS myGPS(gps_Serial);
-    gps_Serial = new Serial(PTD3,PTD2); 
+    pc.printf("top");
+    gps_Serial = new Serial(PTC17,PTC16); 
+    pc.printf("bottom");
     myGPS.begin(9600);
     volatile char c;
     myGPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
@@ -111,6 +115,11 @@
     
     t.start();
     
+    //char reset[100] = "";
+    //char message[100] = "";
+    //char num[50];
+    
+    
     while(1){
         
         if(takeSample){ //3.46 us per loop
@@ -121,13 +130,14 @@
             if((sinIndex+1) > sinRes){
                 sinIndex = 0;
             }
-        
             
             lon = AnLong.read();
             lonRef = AnRefLong.read();
             shor = AnShort.read();
             shorRef = AnRefShort.read();
             
+            
+            
             I = Iarray[sampleIndex];
             Q = Qarray[sampleIndex];
             sLI[sampleIndex] = lon*I;
@@ -144,8 +154,6 @@
                 sampleIndex--;
             }
         }
-        
-        
     
         if(sampleIndex+2 > SAMPLE_LENGTH){ //0.50 seconds
             
@@ -173,6 +181,8 @@
             pc.printf("ShortRef = %f\r\n", filteredShortRef);
             pc.printf("Time: %d:%d:%d \r\n", myGPS.hour, myGPS.minute, myGPS.seconds);
             
+            //snprintf(num,50,"%f",filteredLong);
+            //strcat(message, num);
             
             if (myGPS.fix) pc.printf("Location: %5.2f%c, %5.2f%c\r\n", myGPS.latitude, myGPS.lat, myGPS.longitude, myGPS.lon);
             else           pc.printf("No GPS fix\r\n");
@@ -195,34 +205,10 @@
             t.reset();
         }
         
-        
-        
-        
-        
-        
-        if (sampleIndex+2 > SAMPLE_LENGTH) { // 0.25 seconds
-            
-            sampleIndex = 0;
-            pc.printf("Time: %d:%d:%d \r\n", myGPS.hour, myGPS.minute, myGPS.seconds);
-            fp = fopen("/sd/data.txt", "w");
-            if (fp != NULL){
-                fprintf(fp,"Time: %d:%d:%d.%u \r\n", myGPS.hour, myGPS.minute, myGPS.seconds, myGPS.milliseconds);
-                fclose(fp);
-            }
-
-            if (myGPS.fix) {
-                pc.printf("Location: %5.2f%c, %5.2f%c\r\n", myGPS.latitude, myGPS.lat, myGPS.longitude, myGPS.lon);
-                led_red = !led_red;
-                fp = fopen("/sd/data.txt", "w");
-                if (fp != NULL){
-                    fprintf(fp,"Location: %5.2f%c, %5.2f%c\r\n", myGPS.latitude, myGPS.lat, myGPS.longitude, myGPS.lon);
-                    fclose(fp);
-                }
-            }else{
-                fprintf(fp,"no gps fix\r\n");
-                fclose(fp);
-            }    
-        }
+        //if(gsm_ready()){
+        //    gsm_send_sms(message);
+        //    message[0] = '\0';   
+        //}
         
     }
 }
\ No newline at end of file