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

main.cpp

Committer:
sarahboydster
Date:
2014-05-26
Revision:
0:b6d19a9ddd81

File content as of revision 0:b6d19a9ddd81:

#include "mbed.h"
#include "tsi_sensor.h"

#define ELEC0 9
#define ELEC1 10


AnalogOut analogOut(PTE30);

int main(void) {
    PwmOut led(LED_GREEN);
    TSIAnalogSlider tsi(ELEC0, ELEC1, 40);
    
    while (true) {
        led = 1.0 - tsi.readPercentage();
        analogOut = tsi.readPercentage();
        wait(0.1);
    }
}