yuki hashimoto
/
Analog_in
アナログ入力
main.cpp@0:d86587ed9b1c, 2014-07-28 (annotated)
- Committer:
- hasimo
- Date:
- Mon Jul 28 04:49:01 2014 +0000
- Revision:
- 0:d86587ed9b1c
??????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hasimo | 0:d86587ed9b1c | 1 | #include "mbed.h" |
hasimo | 0:d86587ed9b1c | 2 | #include "TextLCD.h" |
hasimo | 0:d86587ed9b1c | 3 | |
hasimo | 0:d86587ed9b1c | 4 | TextLCD lcd(p24, p26, p27, p28, p29, p30); // rs, e, d4-d7 |
hasimo | 0:d86587ed9b1c | 5 | AnalogIn ain(p15); |
hasimo | 0:d86587ed9b1c | 6 | |
hasimo | 0:d86587ed9b1c | 7 | int main() { |
hasimo | 0:d86587ed9b1c | 8 | float adc; |
hasimo | 0:d86587ed9b1c | 9 | |
hasimo | 0:d86587ed9b1c | 10 | while (1){ |
hasimo | 0:d86587ed9b1c | 11 | lcd.locate(0,0); |
hasimo | 0:d86587ed9b1c | 12 | lcd.printf("%8.3f \n", ain.read()); |
hasimo | 0:d86587ed9b1c | 13 | wait(0.05); // 20Hz update rate |
hasimo | 0:d86587ed9b1c | 14 | } |
hasimo | 0:d86587ed9b1c | 15 | } |