by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
main.cpp@0:e2c8a8062bb5, 2013-05-24 (annotated)
- Committer:
- robt
- Date:
- Fri May 24 21:34:47 2013 +0000
- Revision:
- 0:e2c8a8062bb5
by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
robt | 0:e2c8a8062bb5 | 1 | |
robt | 0:e2c8a8062bb5 | 2 | /*Program Example 8.7: Display analog input data |
robt | 0:e2c8a8062bb5 | 3 | */ |
robt | 0:e2c8a8062bb5 | 4 | #include "mbed.h" |
robt | 0:e2c8a8062bb5 | 5 | #include "TextLCD.h" |
robt | 0:e2c8a8062bb5 | 6 | TextLCD lcd(p19, p20, p21, p22, p23, p24); //rs,e,d0, d1,d2,d3 |
robt | 0:e2c8a8062bb5 | 7 | AnalogIn Ain(p17); |
robt | 0:e2c8a8062bb5 | 8 | float percentage; |
robt | 0:e2c8a8062bb5 | 9 | |
robt | 0:e2c8a8062bb5 | 10 | int main() { |
robt | 0:e2c8a8062bb5 | 11 | while(1){ |
robt | 0:e2c8a8062bb5 | 12 | percentage=Ain*100; |
robt | 0:e2c8a8062bb5 | 13 | lcd.printf("%1.2f",percentage); |
robt | 0:e2c8a8062bb5 | 14 | wait(0.002); |
robt | 0:e2c8a8062bb5 | 15 | lcd.cls(); |
robt | 0:e2c8a8062bb5 | 16 | } |
robt | 0:e2c8a8062bb5 | 17 | } |
robt | 0:e2c8a8062bb5 | 18 |