Adam Ciechalski
/
Inst_LAB_3
Potentiometers experiment
main.cpp
- Committer:
- AdamCiechalski
- Date:
- 2019-05-01
- Revision:
- 1:9444965b4725
- Parent:
- 0:f842d2e7c87f
- Child:
- 2:0df5683f5842
File content as of revision 1:9444965b4725:
#include "mbed.h" #include "C12832.h" C12832 lcd(p5, p7, p6, p8, p11); PwmOut led1(LED1); AnalogIn pot1(p19); int main() { while(1) { led1 = pot1; lcd.cls();//cleaning the display lcd.locate(0,0);//position the cursor in position 0.0 - upper left corner of the display lcd.printf("value of pot1 is %.3f\n", pot1.read());//display of the potentiometer value in the range 0-1 lcd.locate(0,10); //position the cursor in position 0.10 - first column tenth row lcd.printf("voltage of pot1 is %.2fV\n", pot1.read() * 3.3); //display of the voltage value on the potentiometer in the range of 0 - 3.3V wait(0.05); } }