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
Revision 6:288cb3530ef4, committed 2015-05-07
- Comitter:
- lmsousa
- Date:
- Thu May 07 11:25:42 2015 +0000
- Parent:
- 5:b44f5f02b879
- Commit message:
- Sends TSI read value to the serial port.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b44f5f02b879 -r 288cb3530ef4 main.cpp --- 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); + } +}