first

Dependencies:   mbed C12832

Committer:
t00221549
Date:
Sun Aug 08 19:41:12 2021 +0000
Revision:
0:7481eb5e8d32
first commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
t00221549 0:7481eb5e8d32 1 #include "mbed.h"
t00221549 0:7481eb5e8d32 2 #include "C12832.h" // including lcd library
t00221549 0:7481eb5e8d32 3
t00221549 0:7481eb5e8d32 4 PwmOut led1(LED1);
t00221549 0:7481eb5e8d32 5 AnalogIn pot1(p19);
t00221549 0:7481eb5e8d32 6 C12832 lcd(p5, p7, p6, p8, p11);
t00221549 0:7481eb5e8d32 7
t00221549 0:7481eb5e8d32 8 int main()
t00221549 0:7481eb5e8d32 9 {
t00221549 0:7481eb5e8d32 10 while(1) {
t00221549 0:7481eb5e8d32 11 led1 = pot1; // setting the led and output print value to equal the pot1 analogue input value
t00221549 0:7481eb5e8d32 12 lcd.locate(0,0); // lcd output to top left corner
t00221549 0:7481eb5e8d32 13 lcd.printf("Pot 1 value = %.2f", pot1.read()); // lcd print pot float value to 2 decimal places
t00221549 0:7481eb5e8d32 14 lcd.locate(0,11); // lcd output to middle left
t00221549 0:7481eb5e8d32 15 lcd.printf("Pot 1 = %.2e", pot1.read()); // lcd print pot float value to scientific notation to two decimal digits
t00221549 0:7481eb5e8d32 16
t00221549 0:7481eb5e8d32 17 wait(0.01);
t00221549 0:7481eb5e8d32 18
t00221549 0:7481eb5e8d32 19 }
t00221549 0:7481eb5e8d32 20 }