Simple pH class.

Dependents:   Full-Project

Revision:
2:767f53c397ad
Parent:
1:1314058dbadb
--- a/pH_Sensor.cpp	Sat Dec 05 07:31:02 2015 +0000
+++ b/pH_Sensor.cpp	Mon Dec 07 00:05:54 2015 +0000
@@ -1,5 +1,10 @@
 #include "pH_Sensor.h"
 
+/* Function: disableContinuousMode
+ * -------------------------------
+ * The pH sensor initially reads continuously. Changes
+ * to single reading format.
+ */
 void pH_Sensor::disableContinuousMode() {
     printf("pH sensor will NOT run in continous mode.\n");
     if(pH_Serial.writeable() <= 0) printf("Not writable\n");
@@ -10,12 +15,20 @@
     wait(5);
 }
 
+/* Function: setup
+ * ---------------
+ * Initially sets up the pH sensor by setting the baud
+ * rate and disabling the continous mode.
+ */
 void pH_Sensor::setup() {
-    pH_Serial.baud(9600);
+    pH_Serial.baud(PH_BAUD);
     disableContinuousMode();
 }
 
-// Send default message to pH sensor, asking for data.
+/* Function: request
+ * -----------------
+ * Sends a request to the pH sensor asking for a reading.
+ */
 void pH_Sensor::request() {
     printf("Sending pH request...\n");
     if(pH_Serial.writeable() <= 0) printf("Not writable\n");
@@ -24,6 +37,11 @@
     pH_Serial.printf("%c", '\r');
 }
 
+/* Function: read
+ * --------------
+ * Requests a reading and parses the recieved data
+ * to construct and return a float.
+ */
 float pH_Sensor::read() {
     float pH = 0.0;
     request();