![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Lab exercise 2.2 Potentiometers experiment
Diff: main.cpp
- Revision:
- 0:9f16c71a1120
- Child:
- 1:1bb7bf26a054
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Jun 20 11:18:25 2020 +0000 @@ -0,0 +1,31 @@ +#include "mbed.h" +#include "C12832.h" + +PwmOut led1(LED1); +AnalogIn pot1(p19); +C12832 lcd(p5, p7, p6, p8, p11); +float pot1val; + +int main() { + while(1) { + led1 = pot1; + wait(0.01); + + +pot1val = pot1*100; + + lcd.cls(); + wait(.1); + lcd.locate(0,0); + lcd.printf("Pot1 value: %.4f", pot1val); + wait(1); + + lcd.cls(); + wait(.1); + lcd.locate(0,0);; + lcd.printf("Pot1 value: %.4e", pot1.read()); + wait (1); + + + } +}