
Using the pot to change the intensity of the LEDS and printing out a value of the pot to the LCD display
Diff: POT.cpp
- Revision:
- 0:40f8abf6ee00
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/POT.cpp Sat Aug 01 15:42:07 2020 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" +#include "C12832.h" + +C12832 lcd(p5,p7,p6,p8,p11); +PwmOut led1(LED1); +PwmOut led2(LED2); +PwmOut led3(LED3); +PwmOut led4(LED4); +AnalogIn pot1(p19); +float value ; + + + +int main() +{ + while(1) { + value = pot1; + led1=led2=led3 =led4=pot1; + wait(0.01); + lcd.locate(0,9); + lcd.printf ("value is %.2f \n", value); + lcd.locate(0,0); + lcd.printf ("value is %.2e \n", value); + } +}