Programa encargado de leer el slider (sensor capacitivo entre SW1 y SW2) y alimentar con dicho valor el led verde con pwm. Además, muestra el dato por la pantalla de 4 segmentos integrada.
Dependencies: mbed tsi_sensor SLCD
Revision 0:ff4e7f80c9fa, committed 2019-10-14
- Comitter:
- marcospostemsky
- Date:
- Mon Oct 14 03:17:54 2019 +0000
- Commit message:
- code finished
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SLCD.lib Mon Oct 14 03:17:54 2019 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/SLCD/#ef2b3b7f1b01
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Oct 14 03:17:54 2019 +0000 @@ -0,0 +1,33 @@ +#include "mbed.h" +#include "tsi_sensor.h" +#include "SLCD.h" + + +/* This defines will be replaced by PinNames soon */ +#if defined (TARGET_KL25Z) || defined (TARGET_KL46Z) + #define ELEC0 9 + #define ELEC1 10 +#elif defined (TARGET_KL05Z) + #define ELEC0 9 + #define ELEC1 8 +#else + #error TARGET NOT DEFINED +#endif + +SLCD slcd; + +int main(void) { + PwmOut led(LED_GREEN); + TSIAnalogSlider tsi(ELEC0, ELEC1, 40); + float lectura = 0; + slcd.clear(); + + + while (true) { + led = 1.0 - tsi.readPercentage(); + lectura = tsi.readPercentage() * 1024; + slcd.CharPosition=0; + slcd.printf("%d",int(lectura)); // print the heading (NED compass) to the LCD + wait(0.2); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Oct 14 03:17:54 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsi_sensor.lib Mon Oct 14 03:17:54 2019 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Kojto/code/tsi_sensor/#976904559b5c