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.
main.cpp@2:941f7e99e345, 2016-02-23 (annotated)
- Committer:
- OlySolano
- Date:
- Tue Feb 23 00:09:17 2016 +0000
- Revision:
- 2:941f7e99e345
- Parent:
- 1:c234f83e4ee3
- Child:
- 3:a547a9dec222
actualizacion con declaracion de la bomba
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| OlySolano | 0:bceaaaa8460e | 1 | #include "mbed.h" |
| OlySolano | 0:bceaaaa8460e | 2 | |
| OlySolano | 1:c234f83e4ee3 | 3 | Serial pc (USBTX, USBRX); |
| OlySolano | 2:941f7e99e345 | 4 | DigitalOut bomba(D0); |
| OlySolano | 2:941f7e99e345 | 5 | DigitalOut ledg(LED1); |
| OlySolano | 2:941f7e99e345 | 6 | DigitalOut ledr(LED2); |
| OlySolano | 1:c234f83e4ee3 | 7 | AnalogIn hum(A0); |
| OlySolano | 2:941f7e99e345 | 8 | float valor,pin; |
| OlySolano | 1:c234f83e4ee3 | 9 | |
| OlySolano | 0:bceaaaa8460e | 10 | |
| OlySolano | 0:bceaaaa8460e | 11 | int main() { |
| OlySolano | 1:c234f83e4ee3 | 12 | |
| OlySolano | 0:bceaaaa8460e | 13 | while(1) { |
| OlySolano | 2:941f7e99e345 | 14 | // valor=hum; |
| OlySolano | 1:c234f83e4ee3 | 15 | valor=hum.read(); |
| OlySolano | 2:941f7e99e345 | 16 | valor= valor*1000; |
| OlySolano | 2:941f7e99e345 | 17 | wait (1.0); |
| OlySolano | 2:941f7e99e345 | 18 | |
| OlySolano | 2:941f7e99e345 | 19 | if(valor <=500){ |
| OlySolano | 2:941f7e99e345 | 20 | pc.printf("humedo %.0f\n",valor); |
| OlySolano | 2:941f7e99e345 | 21 | ledg=0; |
| OlySolano | 2:941f7e99e345 | 22 | bomba=1; |
| OlySolano | 2:941f7e99e345 | 23 | }else{ |
| OlySolano | 2:941f7e99e345 | 24 | ledr=1; |
| OlySolano | 2:941f7e99e345 | 25 | } |
| OlySolano | 2:941f7e99e345 | 26 | if (valor>500 && valor<850){ |
| OlySolano | 2:941f7e99e345 | 27 | pc.printf("seco %.0f\n",valor); |
| OlySolano | 2:941f7e99e345 | 28 | ledr=0; |
| OlySolano | 2:941f7e99e345 | 29 | bomba=0; |
| OlySolano | 2:941f7e99e345 | 30 | }else{ |
| OlySolano | 2:941f7e99e345 | 31 | ledg=1; |
| OlySolano | 2:941f7e99e345 | 32 | } |
| OlySolano | 2:941f7e99e345 | 33 | if(valor>=850){ |
| OlySolano | 2:941f7e99e345 | 34 | bomba=1; |
| OlySolano | 2:941f7e99e345 | 35 | }} |
| OlySolano | 1:c234f83e4ee3 | 36 | } |