Data log for logging enviornmental, process and system state to FRAM or EPROM chips that do not have support for a file system. Includes support for multiple record types, evolving record types, automatic date and time stamp and copying contents to serial. Will soon support journaling to micro SD file system. We always log to fram first for speed and power conserfaction then copy in bulk to SD cards when we have charging power available.

Dependencies:   data_log mbed

Flexible Data Logger Example Use and Test Code

Detailed Documentation

See home page for data log library https://developer.mbed.org/users/joeata2wh/code/data_log/

License

By Joseph Ellsworth CTO of A2WH Take a look at A2WH.com Producing Water from Air using Solar Energy March-2016 License: https://developer.mbed.org/handbook/MIT-Licence Please contact us http://a2wh.com for help with custom design projects.

Revision:
0:0cfc06f9f18c
Child:
1:58f86fb1fb22
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Mar 30 21:44:52 2016 +0000
@@ -0,0 +1,69 @@
+/* xj-data-log-test-and-exmple.c
+  Shows basic usage of dat_log library and
+  performs some basic tests. 
+  
+  By Joseph Ellsworth CTO of A2WH
+  Take a look at A2WH.com Producing Water from Air using Solar Energy
+  March-2016 License: https://developer.mbed.org/handbook/MIT-Licence 
+  Please contact us http://a2wh.com for help with custom design projects.
+*/
+    
+#include "mbed.h"
+#include "dataLog.h"  
+
+const float adc_ref = 3.3f;
+// SPI PINS 
+#define SPI1_SCK PA_5
+#define SPI1_MISO PA_6
+#define SPI1_MOSI PA_7
+
+// SPI PINS for Data Log chip
+#define dataLogMISOPin  SPI1_MISO
+#define dataLogMOSIPin  SPI1_MOSI
+#define dataLogCLKPin   SPI1_SCK
+#define dataLogSelectPin PC_12
+
+AnalogIn waterTempSense(A0);
+AnalogIn oxygenLevelSense(A1);
+AnalogIn solarStrengthSense(A2);
+AnalogIn waterSpeedSense(A3);
+// imagine for sake of example that we have
+// circuitry that actually convert these Volt
+// readings to useful readings.
+ 
+DigitalOut led(LED1);
+
+
+int main() {
+    printf("\nData Logger Example example\n");
+
+    float meas;
+    char dlbuff[81]; // buffer used internally by this instance of data log
+    DataLogChipType dlchip(dataLogMOSIPin, dataLogMISOPin, dataLogCLKPin, dataLogSelectPin);
+    DLOG *lgr = dlMake(&dlchip, dlbuff, 80);    
+    
+    
+    lgr.log(lgr, "HEAD\tsensors", "waterTemp,oxygenLevel,solarStrength,waterSpeed");
+    
+    
+    while(1) {
+        float waterTemp = waterTempSense.read() * adc_ref;
+        float oxygenLevel = oxygenLevelSense.read() * adc_ref;
+        float solarStrength = solarStrengthSense.read() * adc_ref;
+        float waterSpeed = waterSpeedSense.read() * adc_ref;
+    
+        float tbff
+    // lgr will internally log time.  Whenever the date changes
+    // it will log a new date records.     
+        meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
+        meas = meas * 3300; // Change the value to be in the 0 to 3300 range
+        printf("measure = %.0f mV\n", meas);
+        if (meas > 2000) { // If the value is greater than 2V then switch the LED on
+          led = 1;
+        }
+        else {
+          led = 0;
+        }
+        wait(0.2); // 200 ms
+    }
+}