David Mc Sherry
/
INS_LAB_Q2
Potentiometer experiment
Diff: main.cpp
- Revision:
- 0:c82dcc0ff914
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Aug 18 15:08:39 2021 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +#include "C12832.h" // LCD on Mbed + +PwmOut led1 (LED1); // Control the brightness of LED1 +AnalogIn pot1 (p19); //Used to change brightness +C12832 lcd(p5, p7, p6, p8, p11); // Register the pins needed for LCD + +int main() +{ + + while(1) { + led1 = pot1; // LED1 the same value as POT1 + lcd.locate(0,0); // Area on LCD to start text + lcd.printf("Potentiometer value 1 = %.2f", pot1.read()); + + lcd.locate(0,10); + lcd.printf("Potentiometer value 2 = %.2e", pot1.read()); + + wait(0.5); + } +} \ No newline at end of file