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.
ME_Compresor.h@0:c274503f9285, 2018-06-05 (annotated)
- Committer:
- JAgustinOtero
- Date:
- Tue Jun 05 23:30:18 2018 +0000
- Revision:
- 0:c274503f9285
EJN?3:; Sistema de control de una heladera
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
JAgustinOtero | 0:c274503f9285 | 1 | #include "mbed.h" |
JAgustinOtero | 0:c274503f9285 | 2 | #define apagado 1 |
JAgustinOtero | 0:c274503f9285 | 3 | #define encendido 0 |
JAgustinOtero | 0:c274503f9285 | 4 | |
JAgustinOtero | 0:c274503f9285 | 5 | DigitalOut comp(LED1); |
JAgustinOtero | 0:c274503f9285 | 6 | char ME_Compresor_estado=0; |
JAgustinOtero | 0:c274503f9285 | 7 | enum {C_off,C_on}; |
JAgustinOtero | 0:c274503f9285 | 8 | |
JAgustinOtero | 0:c274503f9285 | 9 | unsigned char ME_Compresor(unsigned char VSet,unsigned char VMed) |
JAgustinOtero | 0:c274503f9285 | 10 | { |
JAgustinOtero | 0:c274503f9285 | 11 | switch(ME_Compresor_estado) { |
JAgustinOtero | 0:c274503f9285 | 12 | case C_off: |
JAgustinOtero | 0:c274503f9285 | 13 | comp=apagado; |
JAgustinOtero | 0:c274503f9285 | 14 | if(VMed>(VSet+20)) { |
JAgustinOtero | 0:c274503f9285 | 15 | ME_Compresor_estado=C_on; |
JAgustinOtero | 0:c274503f9285 | 16 | } |
JAgustinOtero | 0:c274503f9285 | 17 | break; |
JAgustinOtero | 0:c274503f9285 | 18 | case C_on: |
JAgustinOtero | 0:c274503f9285 | 19 | comp=encendido; |
JAgustinOtero | 0:c274503f9285 | 20 | if(VSet>=20){ |
JAgustinOtero | 0:c274503f9285 | 21 | if(VMed<(VSet-20)) ME_Compresor_estado=C_off;} |
JAgustinOtero | 0:c274503f9285 | 22 | else { |
JAgustinOtero | 0:c274503f9285 | 23 | if(VMed==1) ME_Compresor_estado=C_off;} |
JAgustinOtero | 0:c274503f9285 | 24 | break; |
JAgustinOtero | 0:c274503f9285 | 25 | } |
JAgustinOtero | 0:c274503f9285 | 26 | return comp; |
JAgustinOtero | 0:c274503f9285 | 27 | } |