Lee Nam Cheol
/
lab05-app-shield-pot
main.cpp
- Committer:
- namcheol
- Date:
- 2020-05-11
- Revision:
- 1:4a8a315ea215
- Parent:
- 0:f31836d48420
File content as of revision 1:4a8a315ea215:
#include "mbed.h" #include "C12832.h" C12832 lcd(D11, D13, D12, D7, D10); //lcd = (MOSI, SCK, RESET, A0, nCS) AnalogIn pot1(A0); AnalogIn pot2(A1); PwmOut led_r(D5); PwmOut led_g(D9); int main() { lcd.cls(); //clear screen lcd.locate(0, 6); lcd.printf("Rotate Potentiometers!"); while(true) { lcd.locate(0,16); lcd.printf("Pot1=%4.2f, Pot2=%4.2f", pot1.read(), pot2.read()); led_r = 1.0 - pot1.read(); led_g = 1.0 - pot2.read(); thread_sleep_for(200); } }