Dariusz Piskorowski
/
PwmLed_and_Potentiometer
Two colours of RGB Led are switched via two potentiometers
main.cpp
- Committer:
- Dariusz_Piskorowski
- Date:
- 2019-08-11
- Revision:
- 0:916f25fe8103
File content as of revision 0:916f25fe8103:
#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); } }