This program varies the voltage coming from the AnalogOut pin (PTE30) on the FRDM-KL25Z according to the reading from the capacitive touch slider.

Dependencies:   mbed tsi_sensor

Committer:
sarahboydster
Date:
Mon May 26 00:22:43 2014 +0000
Revision:
0:b6d19a9ddd81
First version.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sarahboydster 0:b6d19a9ddd81 1 #include "mbed.h"
sarahboydster 0:b6d19a9ddd81 2 #include "tsi_sensor.h"
sarahboydster 0:b6d19a9ddd81 3
sarahboydster 0:b6d19a9ddd81 4 #define ELEC0 9
sarahboydster 0:b6d19a9ddd81 5 #define ELEC1 10
sarahboydster 0:b6d19a9ddd81 6
sarahboydster 0:b6d19a9ddd81 7
sarahboydster 0:b6d19a9ddd81 8 AnalogOut analogOut(PTE30);
sarahboydster 0:b6d19a9ddd81 9
sarahboydster 0:b6d19a9ddd81 10 int main(void) {
sarahboydster 0:b6d19a9ddd81 11 PwmOut led(LED_GREEN);
sarahboydster 0:b6d19a9ddd81 12 TSIAnalogSlider tsi(ELEC0, ELEC1, 40);
sarahboydster 0:b6d19a9ddd81 13
sarahboydster 0:b6d19a9ddd81 14 while (true) {
sarahboydster 0:b6d19a9ddd81 15 led = 1.0 - tsi.readPercentage();
sarahboydster 0:b6d19a9ddd81 16 analogOut = tsi.readPercentage();
sarahboydster 0:b6d19a9ddd81 17 wait(0.1);
sarahboydster 0:b6d19a9ddd81 18 }
sarahboydster 0:b6d19a9ddd81 19 }