trertr
Dependencies: mbed tsi_sensor
Diff: main.cpp
- Revision:
- 0:832eaddcae50
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Mar 24 09:13:24 2017 +0000 @@ -0,0 +1,24 @@ +#include "mbed.h" +#include "tsi_sensor.h" + +/* This defines will be replaced by PinNames soon */ +#if defined (TARGET_KL25Z) || defined (TARGET_KL46Z) +#define ELEC0 9 +#define ELEC1 10 +#elif defined (TARGET_KL05Z) +#define ELEC0 9 +#define ELEC1 8 +#else +#error TARGET NOT DEFINED +#endif + +int main(void) +{ + PwmOut led(LED_GREEN); + TSIAnalogSlider tsi(ELEC0, ELEC1, 40); + + while (true) { + led = 1.0 - tsi.readPercentage(); + wait(0.1); + } +}