Stanley Cohen
/
kl46z_slider_v1
ssd3341 test of capacitive slider routines
Revision 0:04499bc54bee, committed 2016-09-09
- Comitter:
- scohennm
- Date:
- Fri Sep 09 17:51:13 2016 +0000
- Commit message:
- ssd3341 test of capacitive slider routines
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SLCD.lib Fri Sep 09 17:51:13 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Sissors/code/SLCD/#ef2b3b7f1b01
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TSI.lib Fri Sep 09 17:51:13 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/TSI/#1a60ef257879
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Sep 09 17:51:13 2016 +0000 @@ -0,0 +1,41 @@ +#include "mbed.h" +#include "TSISensor.h" +#include "SLCD.h" +#define TSILIMIT 0.99 +#define LCDCHARLEN 10 +#define DATAINTERVAL 0.1 +#define PROGNAME "kl46z_slider_test_v1\n\r" + +SLCD slcd; //define LCD display +Serial pc(USBTX, USBRX); + +float tsidata; + +void LCDMess(char *lMess){ + slcd.Home(); + slcd.clear(); + slcd.printf(lMess); +} + +int main(void) { + char lcdData[LCDCHARLEN]; + PwmOut gled(LED_GREEN); + PwmOut rled(LED_RED); + pc.printf(PROGNAME); + TSISensor tsi; + + while (true) { + tsidata = tsi.readPercentage(); + if (tsidata > TSILIMIT){ + gled = 0.0; + rled = 0.0; + }else { + pc.printf("\n Position %f\n\r", tsidata); + sprintf (lcdData,"%0.4f",tsidata); + LCDMess(lcdData); + gled = tsidata; + rled = 1.0 - tsidata; + } + wait(DATAINTERVAL); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Sep 09 17:51:13 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/2e9cc70d1897 \ No newline at end of file