Prints moisture in soil (0-1000) high-low
Fork of AnalogIn-HelloWorld by
Revision 2:ae1e42768e3c, committed 2015-05-29
- Comitter:
- Evu
- Date:
- Fri May 29 08:46:45 2015 +0000
- Parent:
- 1:0a8f602aeec9
- Commit message:
- Moisture in soil demo
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 0a8f602aeec9 -r ae1e42768e3c main.cpp --- 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); } }
diff -r 0a8f602aeec9 -r ae1e42768e3c mbed.bld --- a/mbed.bld Wed Dec 10 16:19:08 2014 -0600 +++ b/mbed.bld Fri May 29 08:46:45 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/cbbeb26dbd92 \ No newline at end of file