![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
2.2 Potentiometers experiment lab question
main.cpp@0:6f214ce8097e, 2020-06-25 (annotated)
- Committer:
- tonyk37
- Date:
- Thu Jun 25 08:41:16 2020 +0000
- Revision:
- 0:6f214ce8097e
Potentiometers experiment
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tonyk37 | 0:6f214ce8097e | 1 | #include "mbed.h" |
tonyk37 | 0:6f214ce8097e | 2 | #include "C12832.h" |
tonyk37 | 0:6f214ce8097e | 3 | |
tonyk37 | 0:6f214ce8097e | 4 | C12832 lcd(p5, p7, p6, p8, p11); |
tonyk37 | 0:6f214ce8097e | 5 | |
tonyk37 | 0:6f214ce8097e | 6 | PwmOut led1(LED1); |
tonyk37 | 0:6f214ce8097e | 7 | AnalogIn pot1(p19); |
tonyk37 | 0:6f214ce8097e | 8 | |
tonyk37 | 0:6f214ce8097e | 9 | |
tonyk37 | 0:6f214ce8097e | 10 | int main() { |
tonyk37 | 0:6f214ce8097e | 11 | while(1) { |
tonyk37 | 0:6f214ce8097e | 12 | led1 = pot1; |
tonyk37 | 0:6f214ce8097e | 13 | wait(0.01); |
tonyk37 | 0:6f214ce8097e | 14 | lcd.locate(0,0); |
tonyk37 | 0:6f214ce8097e | 15 | lcd.printf("text %.2f", pot1.read()); |
tonyk37 | 0:6f214ce8097e | 16 | lcd.printf("text %.2e", pot1.read()); |
tonyk37 | 0:6f214ce8097e | 17 | } |
tonyk37 | 0:6f214ce8097e | 18 | } |