Analogue soil moisture reader - simple

Dependencies:   libmDot-mbed5

Revision:
1:15442a59c47f
Parent:
0:3d2e0dbfbc41
Child:
2:d8858f9fc425
--- a/main.cpp	Wed Oct 18 03:09:40 2017 +0000
+++ b/main.cpp	Wed Nov 01 03:51:21 2017 +0000
@@ -23,17 +23,13 @@
 
 // these options must match the settings on your gateway/server
 /*
-Current test settings
-dev address: 072389f7
-net sess key: b35aca73d283996dc3cbc0803af04547
-app sess key: d6f28430da4035273b9e3c07eb30c0dd
 */
 //device address
-static uint8_t network_address[] = { 0x07, 0x23, 0x89, 0xf7 };
+static uint8_t network_address[] = { 0x07, 0x47, 0x2b, 0xd0 };
 //network session key
-static uint8_t network_session_key[] = { 0xb3, 0x5a, 0xca, 0x73, 0xd2, 0x83, 0x99, 0x6d, 0xc3, 0xcb, 0xc0, 0x80, 0x3a, 0xf0, 0x45, 0x47 };
+static uint8_t network_session_key[] = { 0xd8, 0x0b, 0x02, 0xd3, 0xf9, 0x06, 0x7f, 0x85, 0x75, 0xa6, 0xbe, 0x82, 0x23, 0x6e, 0xbd, 0x77 };
 //application sesssion or data session key
-static uint8_t data_session_key[] = { 0xd6, 0xf2, 0x84, 0x30, 0xda, 0x40, 0x35, 0x27, 0x3b, 0x9e, 0x3c, 0x07, 0xeb, 0x30, 0xc0, 0xdd };
+static uint8_t data_session_key[] = { 0x86, 0x28, 0x35, 0x20, 0xa3, 0xc1, 0x16, 0x99, 0xdd, 0xf0, 0x3e, 0xa1, 0xa1, 0x42, 0x5f, 0x04 };
 static uint8_t frequency_sub_band = 2; //VFI
 static bool public_network = true;
 //enable receipt of ackknowledge packets 0 = No, 1 = Yes
@@ -134,13 +130,12 @@
         std::vector<uint8_t> data;
         
         //read sensor
-        //read sensor as float (0.0-1.0, multiply by 1000)
         //read multiple times - this just smoothes the value out a little bit
-        float moist1 = a0.read() * 1000;
+        float moist1 = a0.read() * 1023;
         wait_ms(100);
-        float moist2 = a0.read() * 1000;
+        float moist2 = a0.read() * 1023;
         wait_ms(100);
-        float moist3 = a0.read() * 1000;
+        float moist3 = a0.read() * 1023;
         wait_ms(100);
         //average the multiple readings
         float moistF = (moist1 + moist2 + moist3) / 3;
@@ -160,7 +155,7 @@
         send_data(data);
 
         // go to sleep and wake up automatically sleep_time seconds later 
-        uint32_t sleep_time = 60;
+        uint32_t sleep_time = 30;
         //false is "don't deep sleep" - mDot doesn't do that 
         dot->sleep(sleep_time, mDot::RTC_ALARM, false);
     }