This library allow you to convert FRDM-KL25Z built-in touch slider in to 4 touch buttons.
Dependents: CapacitiveTouchButton CapacitiveTouchButton
TouchButton.cpp
- Committer:
- virajjayaweera
- Date:
- 2013-07-13
- Revision:
- 0:2afd6e977c5b
File content as of revision 0:2afd6e977c5b:
#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; }