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 1:51b1b688179a, committed 2012-10-12
- Comitter:
- chris
- Date:
- Fri Oct 12 11:42:21 2012 +0000
- Parent:
- 0:0f00f07ebde0
- Child:
- 2:6136133bdf88
- Commit message:
- Tidied up formatting
Changed in this revision
TSI.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/TSI.lib Thu Oct 11 11:05:51 2012 +0000 +++ b/TSI.lib Fri Oct 12 11:42:21 2012 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/emilmont/code/TSI/#afbd8e2c8bc0 +http://mbed.org/users/emilmont/code/TSI/#507b1f67804b
--- a/main.cpp Thu Oct 11 11:05:51 2012 +0000 +++ b/main.cpp Fri Oct 12 11:42:21 2012 +0000 @@ -1,14 +1,12 @@ #include "mbed.h" -#include "TSI_Sensor.h" +#include "TSISensor.h" int main(void) { - DigitalOut led(LED_GREEN); - TSI_Sensor tsi; + PwmOut led(LED_GREEN); + TSISensor tsi; while (true) { - printf("slider percentage: %d%\r\n", tsi.getPercentage()); - printf("slider distance: %dmm\r\n", tsi.getDistance()); - wait(1); - led = !led; + led = 1.0 - tsi.readPercentage(); + wait(0.1); } -} +} \ No newline at end of file