/** tsi_slider - an example for the tsi_sensor library * * Read the capacitive touch slider of the FRDM-KL25Z board * and control the power of the green LED accordingly. * * Hardware requirements: * - Freescale FRDM-KL25Z board */
Dependencies: mbed tsi_sensor
Fork of 04_tsi_slider by
Revision 0:fe50a5288858, committed 2015-11-03
- Comitter:
- icserny
- Date:
- Tue Nov 03 07:14:14 2015 +0000
- Commit message:
- First version
Changed in this revision
diff -r 000000000000 -r fe50a5288858 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Nov 03 07:14:14 2015 +0000 @@ -0,0 +1,21 @@ +/** tsi_slider - an example for the tsi_sensor library + * + * Read the capacitive touch slider of the FRDM-KL25Z board + * and control the power of the green LED accordingly. + * + * Hardware requirements: + * - Freescale FRDM-KL25Z board + */ + +#include "mbed.h" +#include "tsi_sensor.h" + +int main(void) { + PwmOut led(LED_GREEN); //Configure PWM output for the green LED + TSIAnalogSlider tsi(PTB16,PTB17,40);//Configure for the FRDM-KL25Z slider + while (true) { + float s = tsi.readPercentage(); //Read slider status + led = 1.0 - s; //Control LED power + wait(0.1); //wait a little... + } +} \ No newline at end of file
diff -r 000000000000 -r fe50a5288858 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Nov 03 07:14:14 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file
diff -r 000000000000 -r fe50a5288858 tsi_sensor.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tsi_sensor.lib Tue Nov 03 07:14:14 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/Kojto/code/tsi_sensor/#976904559b5c