Dariusz Piskorowski
/
PwmLed_and_Potentiometer
Diff: main.cpp
- Revision:
- 0:916f25fe8103
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Aug 11 01:42:19 2019 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" +#include "C12832_lcd.h" + +C12832_LCD lcd; + +PwmOut red(p23); +PwmOut green(p24); +AnalogIn pot1(p19); +AnalogIn pot2(p20); + +float pot1val, pot2val; + +int main() { + while(1) { + pot1val=pot1.read(); + pot2val=pot2.read(); + red=pot1val; + green=pot2val; + lcd.cls(); + lcd.locate(0,4); + lcd.printf("pot1= %.3f %.3f V / pot2= %.3f %.3f V\n", + 1-pot1val, 3.3-pot1val*3.3, 1-pot2val, 3.3-pot2val*3.3 ); + wait(0.5); + } +}