This library allow you to convert FRDM-KL25Z built-in touch slider in to 4 touch buttons.

Dependencies:   TSI

Dependents:   CapacitiveTouchButton CapacitiveTouchButton

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TouchButton.cpp Source File

TouchButton.cpp

00001 #include "mbed.h"
00002 #include "TSISensor.h"
00003 #include "TouchButton.h"
00004 
00005 TSISensor tsi;
00006 
00007 int TouchButton::PresedButton(void)
00008 {
00009  
00010     if(tsi.readPercentage()<0.01)
00011         return 0;
00012     else if(tsi.readPercentage()>0.75)  
00013         return 4;
00014     else if(tsi.readPercentage()>0.5)  
00015         return 3;
00016     else if(tsi.readPercentage()>0.25)  
00017         return 2;   
00018     else   
00019         return 1;
00020   
00021 }