mbed FRDM-KL25ZのTouch Sensorのテスト
Dependencies: TSI TextLCD mbed
Fork of FRDM_TSI by
main.cpp@5:a03fc201d343, 2014-08-11 (annotated)
- Committer:
- robo8080
- Date:
- Mon Aug 11 23:55:06 2014 +0000
- Revision:
- 5:a03fc201d343
- Parent:
- 1:51b1b688179a
test1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 0:0f00f07ebde0 | 1 | #include "mbed.h" |
chris | 1:51b1b688179a | 2 | #include "TSISensor.h" |
robo8080 | 5:a03fc201d343 | 3 | #include "TextLCD.h" |
robo8080 | 5:a03fc201d343 | 4 | |
robo8080 | 5:a03fc201d343 | 5 | TextLCD lcd(PTD3, PTD2, PTA5, PTA4, PTA12, PTD4); // rs, e, d0-d3 |
emilmont | 0:0f00f07ebde0 | 6 | |
emilmont | 0:0f00f07ebde0 | 7 | int main(void) { |
robo8080 | 5:a03fc201d343 | 8 | //PwmOut led(LED_GREEN); |
chris | 1:51b1b688179a | 9 | TSISensor tsi; |
robo8080 | 5:a03fc201d343 | 10 | float ts; |
robo8080 | 5:a03fc201d343 | 11 | int n; |
emilmont | 0:0f00f07ebde0 | 12 | while (true) { |
robo8080 | 5:a03fc201d343 | 13 | ts = tsi.readPercentage(); |
robo8080 | 5:a03fc201d343 | 14 | lcd.cls(); |
robo8080 | 5:a03fc201d343 | 15 | //lcd.locate(0,0); |
robo8080 | 5:a03fc201d343 | 16 | n = (int)(16.0 * ts); |
robo8080 | 5:a03fc201d343 | 17 | for(int i = 0; i < n; i++) |
robo8080 | 5:a03fc201d343 | 18 | { |
robo8080 | 5:a03fc201d343 | 19 | lcd.putc('*'); |
robo8080 | 5:a03fc201d343 | 20 | } |
robo8080 | 5:a03fc201d343 | 21 | lcd.locate(0,1); |
robo8080 | 5:a03fc201d343 | 22 | lcd.printf("data = %.3f",ts); |
robo8080 | 5:a03fc201d343 | 23 | //led = 1.0 - tsi.readPercentage(); |
chris | 1:51b1b688179a | 24 | wait(0.1); |
emilmont | 0:0f00f07ebde0 | 25 | } |
chris | 1:51b1b688179a | 26 | } |