Prints moisture in soil (0-1000) high-low

Dependencies:   mbed

Fork of AnalogIn-HelloWorld by Mbed

Revision:
2:ae1e42768e3c
Parent:
0:101a12a915c6
--- a/main.cpp	Wed Dec 10 16:19:08 2014 -0600
+++ b/main.cpp	Fri May 29 08:46:45 2015 +0000
@@ -22,19 +22,19 @@
 
 int main(void)
 {
-    while (1) {
+    //no need?
+//   while (1) {
         // test the voltage on the initialized analog pin
         //  and if greater than 0.3 * VCC set the digital pin
         //  to a logic 1 otherwise a logic 0
-        if(ain > 0.3f) {
-            dout = 1;
-        } else {
-            dout = 0;
-        }
+//        if(ain > 0.3f) {
+//            dout = 1;
+//        } else {
+//            dout = 0;
+//        }
         
-        // print the percentage and 16 bit normalized values
-        printf("percentage: %3.3f%%\n", ain.read()*100.0f);
-        printf("normalized: 0x%04X \n", ain.read_u16());
+    //Code to print
+        printf("Moisture in soil: %f\n",ain.read()*1000.0f);
         wait(0.2f);
     }
 }