trertr

Dependencies:   mbed tsi_sensor

Committer:
Charrua
Date:
Fri Mar 24 09:13:24 2017 +0000
Revision:
0:832eaddcae50
rew

Who changed what in which revision?

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