The TSI Analog slider demo for the freedom platform with Kinetis L MCU.

Dependencies:   mbed tsi_sensor

Fork of frdm_tsi_slider by Freescale

Committer:
Kojto
Date:
Sun Feb 23 18:32:55 2014 +0000
Revision:
2:b13f658fd99f
Parent:
0:5d433bc41aba
Electrodes are part of Analog slider, app does not need to create own instances

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 0:5d433bc41aba 1 #include "mbed.h"
Kojto 0:5d433bc41aba 2 #include "tsi_sensor.h"
Kojto 0:5d433bc41aba 3
Kojto 2:b13f658fd99f 4 /* This defines will be replaced by PinNames soon */
Kojto 2:b13f658fd99f 5 #if defined (TARGET_KL25Z) || defined (TARGET_KL46Z)
Kojto 0:5d433bc41aba 6 #define ELEC0 9
Kojto 0:5d433bc41aba 7 #define ELEC1 10
Kojto 0:5d433bc41aba 8 #elif defined (TARGET_KL05Z)
Kojto 0:5d433bc41aba 9 #define ELEC0 9
Kojto 0:5d433bc41aba 10 #define ELEC1 8
Kojto 0:5d433bc41aba 11 #else
Kojto 0:5d433bc41aba 12 #error TARGET NOT DEFINED
Kojto 0:5d433bc41aba 13 #endif
Kojto 0:5d433bc41aba 14
Kojto 0:5d433bc41aba 15 int main(void) {
Kojto 0:5d433bc41aba 16 PwmOut led(LED_GREEN);
Kojto 2:b13f658fd99f 17 TSIAnalogSlider tsi(ELEC0, ELEC1, 40);
Kojto 0:5d433bc41aba 18
Kojto 0:5d433bc41aba 19 while (true) {
Kojto 0:5d433bc41aba 20 led = 1.0 - tsi.readPercentage();
Kojto 0:5d433bc41aba 21 wait(0.1);
Kojto 0:5d433bc41aba 22 }
Kojto 0:5d433bc41aba 23 }