Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 1:c234f83e4ee3
- Parent:
- 0:bceaaaa8460e
- Child:
- 2:941f7e99e345
--- a/main.cpp Fri Feb 19 13:13:08 2016 +0000
+++ b/main.cpp Fri Feb 19 14:34:37 2016 +0000
@@ -1,12 +1,25 @@
#include "mbed.h"
-DigitalOut myled(LED1);
+Serial pc (USBTX, USBRX);
+//DigitalIn hum(D0);
+AnalogIn hum(A0);
+float valor;
+
int main() {
+
while(1) {
- myled = 1;
- wait(0.2);
- myled = 0;
- wait(0.2);
- }
-}
+
+ valor=hum.read();
+
+ if(valor <=300){
+ pc.printf("muy humedo %d\n",valor);
+ }
+ if (valor>300 && valor <=700){
+ pc.printf ("humedo, no regar %d\n", valor);
+ if (valor>700){
+ pc.printf("seco %d\n",valor);
+ wait(5.0);
+ }}}
+
+ }