Controlling Blinking frequency using TSI Slider
Dependencies: mbed tsi_sensor
Diff: main.cpp
- Revision:
- 3:a47ba029fe08
- Parent:
- 2:b13f658fd99f
- Child:
- 4:fe602d6e48d9
--- a/main.cpp Sun Feb 23 18:32:55 2014 +0000 +++ b/main.cpp Thu Nov 03 19:36:17 2016 +0000 @@ -14,10 +14,16 @@ int main(void) { PwmOut led(LED_GREEN); + Serial pc(USBTX, USBRX); TSIAnalogSlider tsi(ELEC0, ELEC1, 40); - + float x; + x = 0.0; while (true) { - led = 1.0 - tsi.readPercentage(); - wait(0.1); + + pc.printf("valus is %f \n",x); + led = !led; + wait(x); + x = tsi.readPercentage(); + } }