Kevin Sullivan / Mbed 2 deprecated lab2_2

Dependencies:   mbed C12832

Committer:
kevinsullivan
Date:
Tue Aug 04 07:43:57 2020 +0000
Revision:
3:ace46fcebfd6
Parent:
2:6bc37de37167
Child:
4:59ea87bb5b80
Q2.2 summer lab 2020

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kevinsullivan 0:376219f61e79 1 #include "mbed.h"
kevinsullivan 0:376219f61e79 2 #include "C12832.h"
kevinsullivan 2:6bc37de37167 3
kevinsullivan 0:376219f61e79 4 Serial pc(USBTX, USBRX); // tx, rx
kevinsullivan 0:376219f61e79 5 PwmOut led1(LED1);
kevinsullivan 2:6bc37de37167 6 PwmOut led2(LED2);
kevinsullivan 0:376219f61e79 7 AnalogIn pot1(p19);
kevinsullivan 0:376219f61e79 8 C12832 lcd(p5,p7,p6,p8,p11);
kevinsullivan 2:6bc37de37167 9
kevinsullivan 0:376219f61e79 10 int main()
kevinsullivan 0:376219f61e79 11 {
kevinsullivan 0:376219f61e79 12 while(1) {
kevinsullivan 2:6bc37de37167 13 float volt_out = pot1;
kevinsullivan 0:376219f61e79 14 led1 = pot1;
kevinsullivan 2:6bc37de37167 15 led2 = !led1; // NOT LED1; When led1 is off led2 is on.
kevinsullivan 0:376219f61e79 16 wait(0.01);
kevinsullivan 0:376219f61e79 17 lcd.locate(0,0); //brings the cursor on the LCD back to the top left corner
kevinsullivan 2:6bc37de37167 18 lcd.printf("value = %.3fV\n",volt_out); // displays the voltage value on the LCD1 to 3 decimal places
kevinsullivan 2:6bc37de37167 19 lcd.printf("value = %.1eV\n",volt_out); // displays the voltage value on the LCD1 in scientific notation
kevinsullivan 3:ace46fcebfd6 20
kevinsullivan 0:376219f61e79 21 }
kevinsullivan 0:376219f61e79 22 }