Ag demo with soil moisture

Dependencies:   DOGS102 ISL29011 MMA845x MPL3115A2 NCP5623B libmDot mbed-rtos mbed-src

Fork of MTDOT-EVBDemo-DRH by Dave Heitzman

Files at this revision

API Documentation at this revision

Comitter:
skovarik
Date:
Mon Feb 22 16:14:28 2016 +0000
Parent:
8:014495d266f3
Commit message:
added soil moisture to Ag demo

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 014495d266f3 -r daa92715f700 main.cpp
--- a/main.cpp	Thu Feb 18 23:32:34 2016 +0000
+++ b/main.cpp	Mon Feb 22 16:14:28 2016 +0000
@@ -98,11 +98,13 @@
 
 MPL3115A2* resetBaro(const MPL3115A2* oldBaro);
 
+AnalogIn moisture_sensor(PB_1);
+
 /* **** replace these values with the proper public or private network settings ****
  * config_network_nameand config_network_pass are for private networks.
  */
-static std::string config_network_name = "Escalation";
-static std::string config_network_pass = "Escalation";
+static std::string config_network_name = "MTCDT-18321832";
+static std::string config_network_pass = "MTCDT-18321832";
 static uint8_t config_frequency_sub_band = 3;
 
 /*  config_app_id and config_app_key are for public networks.
@@ -119,6 +121,7 @@
 int32_t num_whole, mdot_ret;
 uint32_t pressure;
 int16_t num_frac;
+float moisture;
 
 bool exit_program = false;
 
@@ -533,6 +536,12 @@
         sprintf(txtstr, "Light=%ld.%02d lux", num_whole, num_frac );
         sprintf(lora_light_string, "%ld.%02d", num_whole, num_frac );
         evbLCD->writeText(0,7,font_6x8,txtstr,strlen(txtstr));
+        
+        /*
+         * retrieve and print out moisture from Analog moisture sensor
+         */
+         moisture = moisture_sensor;
+         printf("moisture: %f\r\n", moisture);
 
         evbLCD->endUpdate();
         printf("finished iteration %d\n\r",(++i));
@@ -564,14 +573,15 @@
 //         if ((mdot_ret = mdot_radio->send(mdot_data)) != mDot::MDOT_OK) {
 //            sprintf(sensor_text, "x:%d,y:%d,z:%d,p:%s,a:%s,t:%s,l:%s",
 
-            sprintf(sensor_text, "%d,%d,%d,%s,%s,%s,%s",
+            sprintf(sensor_text, "%d,%d,%d,%s,%s,%s,%s,%f",
             	accel_data._x,
             	accel_data._y,
             	accel_data._z,
             	lora_press_string,
             	lora_alt_string,
             	lora_temp_string,
-            	lora_light_string);
+            	lora_light_string,
+            	moisture);
             if ((mdot_ret = sendString((const std::string)sensor_text)) != mDot::MDOT_OK) {
                 log_error(mdot_radio, "failed to send", mdot_ret);
             } else {