Flotsam / Full-Project

Dependencies:   GPSLibrary GSM mbed-modifed Storage_Library Temp_Library Wakeup pH_Sensor

Revision:
8:b607768bfa0a
Parent:
5:e180c73f4f70
Child:
9:b6e9751fbcba
--- a/main.cpp	Fri Nov 06 20:20:45 2015 +0000
+++ b/main.cpp	Mon Nov 09 19:01:35 2015 +0000
@@ -4,32 +4,34 @@
 #include "MBed_Adafruit_GPS.h"
 #include <string>
 
+// Cellular communication constants
 #define FONA_TX D8
 #define FONA_RX D2
 #define FONA_RST D3
 #define FONA_RI D4
 #define FONA_KEY D5
 
+// Global Positioning System constants
 #define GPS_TX D6
 #define GPS_RX PB_11
 
+// pH sensor constants
 #define PH_TX PC_10
 #define PH_RX PC_11
 
+// Cellular communication global variables
 Adafruit_FONA fona(FONA_TX, FONA_RX, FONA_RST, FONA_RI);
 Serial pcSerial(USBTX, USBRX);
 DigitalOut key(FONA_KEY);
 
-// GPS
+// GPS global variables
 char c; //when read via Adafruit_GPS::read(), the class returns single character stored here
 Timer refresh_Timer; //sets up a timer for use in loop; how often do we print GPS info?
 const int refresh_Time = 2000; //refresh time in ms
 Serial gps_Serial(GPS_TX, GPS_RX); // Serial object for GPS
 Adafruit_GPS myGPS(&gps_Serial);
 
-
-
-// pH sensor
+// pH sensor global variables
 Serial ph_Serial (PH_TX, PH_RX);
 string sensorstring = "";
 bool input_stringcomplete = false;
@@ -37,21 +39,23 @@
 float pH;
 
 void setupPCSerial() {
-    //pcSerial.baud(9600); // This is what the pH sensor used to have.
     pcSerial.baud(115200);
-    pcSerial.printf("\n\nConnection established at 115200 baud...\n");
+    pcSerial.printf("\n\n PC Serial connection established at 115200 baud.\n");
 }
 
-void setupPH() {
-    ph_Serial.baud(9600);
-    printf("Disabling continous mode.\n");
+void disableContinuousMode() {
+    printf("pH sensor will NOT run in continous mode.\n");
     if(ph_Serial.writeable() <= 0) printf("Not writable\n");
     // disable continuous mode
     ph_Serial.printf("C,0");
     ph_Serial.printf("%c", '\r');
     printf("Waiting five seconds... ");
     wait(5);
-    printf("done\n");
+}
+
+void setupPH() {
+    ph_Serial.baud(9600);
+    disableContinuousMode();
 }
 
 void setupGPS() {