![](/media/cache/profiles/Pass2.jpg.50x50_q85.jpg)
TSI read values are now sent to the serial port. Red LED part of the RGB will light up with an intensity that depends on the TSI read value.
Fork of FRDM_TSI by
Diff: main.cpp
- Revision:
- 6:288cb3530ef4
- Parent:
- 1:51b1b688179a
--- a/main.cpp Thu May 09 09:26:46 2013 +0000 +++ b/main.cpp Thu May 07 11:25:42 2015 +0000 @@ -1,12 +1,19 @@ #include "mbed.h" #include "TSISensor.h" +Serial pc(USBTX, USBRX); -int main(void) { - PwmOut led(LED_GREEN); +int main(void) +{ + pc.baud(9600); + PwmOut rled(LED_RED); TSISensor tsi; - - while (true) { - led = 1.0 - tsi.readPercentage(); - wait(0.1); - } -} \ No newline at end of file + rled=1; + + while (true) + { + float n=tsi.readPercentage(); + pc.printf("Percentage= %3.0f %% \r\n ",n*100); + rled = 1.0 - n; + wait(0.1); + } +}