Vin ADC count

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 
00004 #define ON 1
00005 #define OFF 0
00006 
00007 DigitalOut mled1(LED1);
00008 DigitalOut mled2(LED2);
00009 DigitalOut mled3(LED3);
00010 DigitalOut mled4(LED4);
00011 AnalogIn adc_in(p20);
00012 
00013 TextLCD lcd(p24, p25, p26, p27, p28, p29, p30,16,2); // rs, rw, e, d0, d1, d2, d3
00014 
00015 void main() {      
00016     while(1){
00017       lcd.cls();
00018       lcd.locate(0,0);
00019       lcd.printf("Vin:%2.1fV",adc_in.read()*15);
00020       lcd.locate(0,1);
00021       lcd.printf("Mode:Vin now!");
00022       mled1=ON;
00023       mled1=ON;
00024       wait(0.3);
00025       lcd.locate(0,1);
00026       lcd.printf("Mode:        ");
00027       mled1=OFF;
00028       wait(0.3);
00029   }    
00030 }