Example program to control the brightness of an LED using the touch sensor interface
Dependents: FRDM-KL46Z_LCD_Test FRDM-KL46Z_LCD_Test FRDM-KL46Z_I2C-Scanner
Legacy Warning
This is an mbed 2 example. To learn more about mbed OS 5, visit the docs.
main.cpp@0:0f00f07ebde0, 2012-10-11 (annotated)
- Committer:
- emilmont
- Date:
- Thu Oct 11 11:05:51 2012 +0000
- Revision:
- 0:0f00f07ebde0
- Child:
- 1:51b1b688179a
KL25Z TSI example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 0:0f00f07ebde0 | 1 | #include "mbed.h" |
emilmont | 0:0f00f07ebde0 | 2 | #include "TSI_Sensor.h" |
emilmont | 0:0f00f07ebde0 | 3 | |
emilmont | 0:0f00f07ebde0 | 4 | int main(void) { |
emilmont | 0:0f00f07ebde0 | 5 | DigitalOut led(LED_GREEN); |
emilmont | 0:0f00f07ebde0 | 6 | TSI_Sensor tsi; |
emilmont | 0:0f00f07ebde0 | 7 | |
emilmont | 0:0f00f07ebde0 | 8 | while (true) { |
emilmont | 0:0f00f07ebde0 | 9 | printf("slider percentage: %d%\r\n", tsi.getPercentage()); |
emilmont | 0:0f00f07ebde0 | 10 | printf("slider distance: %dmm\r\n", tsi.getDistance()); |
emilmont | 0:0f00f07ebde0 | 11 | wait(1); |
emilmont | 0:0f00f07ebde0 | 12 | led = !led; |
emilmont | 0:0f00f07ebde0 | 13 | } |
emilmont | 0:0f00f07ebde0 | 14 | } |