Libreria para el Ejercicio N°3
SETdata_TSI.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 | #include "TSISensor.h" |
JAgustinOtero | 0:c274503f9285 | 3 | #define InterruptTime 0.1 |
JAgustinOtero | 0:c274503f9285 | 4 | #define RetainTime 3 |
JAgustinOtero | 0:c274503f9285 | 5 | #define MAXValue 10 //Valor entre 0 y 9 |
JAgustinOtero | 0:c274503f9285 | 6 | #define MINValue 1 |
JAgustinOtero | 0:c274503f9285 | 7 | |
JAgustinOtero | 0:c274503f9285 | 8 | unsigned char tempSeteada = 0; |
JAgustinOtero | 0:c274503f9285 | 9 | unsigned char var_RetainData = 0; |
JAgustinOtero | 0:c274503f9285 | 10 | TSISensor PanelTactil; |
JAgustinOtero | 0:c274503f9285 | 11 | |
JAgustinOtero | 0:c274503f9285 | 12 | unsigned char SETData() |
JAgustinOtero | 0:c274503f9285 | 13 | { |
JAgustinOtero | 0:c274503f9285 | 14 | if(PanelTactil.readPercentage() != 0) |
JAgustinOtero | 0:c274503f9285 | 15 | tempSeteada = (PanelTactil.readPercentage() * ((MAXValue - MINValue) * 10)) + (MINValue * 10); |
JAgustinOtero | 0:c274503f9285 | 16 | return tempSeteada; |
JAgustinOtero | 0:c274503f9285 | 17 | } |
JAgustinOtero | 0:c274503f9285 | 18 | |
JAgustinOtero | 0:c274503f9285 | 19 | unsigned char RetainData() |
JAgustinOtero | 0:c274503f9285 | 20 | { |
JAgustinOtero | 0:c274503f9285 | 21 | if(PanelTactil.readPercentage() > 0) var_RetainData=RetainTime / InterruptTime; |
JAgustinOtero | 0:c274503f9285 | 22 | if(var_RetainData != 0) |
JAgustinOtero | 0:c274503f9285 | 23 | var_RetainData--; |
JAgustinOtero | 0:c274503f9285 | 24 | return var_RetainData; |
JAgustinOtero | 0:c274503f9285 | 25 | } |