This library allow you to convert FRDM-KL25Z built-in touch slider in to 4 touch buttons.
Dependents: CapacitiveTouchButton CapacitiveTouchButton
Diff: TouchButton.cpp
- Revision:
- 0:2afd6e977c5b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TouchButton.cpp Sat Jul 13 14:14:40 2013 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +#include "TSISensor.h" +#include "TouchButton.h" + +TSISensor tsi; + +int TouchButton::PresedButton(void) +{ + + if(tsi.readPercentage()<0.01) + return 0; + else if(tsi.readPercentage()>0.75) + return 4; + else if(tsi.readPercentage()>0.5) + return 3; + else if(tsi.readPercentage()>0.25) + return 2; + else + return 1; + +} \ No newline at end of file