Libreria para el Ejercicio N°3
Diff: SETdata_TSI.h
- Revision:
- 0:c274503f9285
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SETdata_TSI.h Tue Jun 05 23:30:18 2018 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" +#include "TSISensor.h" +#define InterruptTime 0.1 +#define RetainTime 3 +#define MAXValue 10 //Valor entre 0 y 9 +#define MINValue 1 + +unsigned char tempSeteada = 0; +unsigned char var_RetainData = 0; +TSISensor PanelTactil; + +unsigned char SETData() +{ + if(PanelTactil.readPercentage() != 0) + tempSeteada = (PanelTactil.readPercentage() * ((MAXValue - MINValue) * 10)) + (MINValue * 10); + return tempSeteada; +} + +unsigned char RetainData() +{ + if(PanelTactil.readPercentage() > 0) var_RetainData=RetainTime / InterruptTime; + if(var_RetainData != 0) + var_RetainData--; + return var_RetainData; +}