Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 // ADC3 00002 #include "mbed.h" 00003 #include "TextLCD.h" 00004 00005 #define ON 1 00006 #define OFF 0 00007 00008 DigitalOut mled1(LED1); 00009 DigitalOut mled2(LED2); 00010 DigitalOut mled3(LED3); 00011 DigitalOut mled4(LED4); 00012 AnalogIn vin_adc(p20); 00013 AnalogIn vr_adc(p19); 00014 00015 TextLCD lcd(p24, p25, p26, p27, p28, p29, p30,16,2); // rs, rw, e, d0, d1, d2, d3 00016 float adc_volt; 00017 00018 int main() { 00019 float vr_data; 00020 while(1){ 00021 vr_data=vr_adc.read(); 00022 lcd.cls(); 00023 lcd.locate(0,0); 00024 lcd.printf("Vin:%2.1fV",vin_adc.read()*15); 00025 lcd.locate(0,1); 00026 lcd.printf("Vr:%2.1fV",vr_data); 00027 mled1=ON; 00028 wait(vr_data); 00029 mled1=OFF; 00030 wait(vr_data); 00031 }//while 00032 }//main
Generated on Tue Jul 12 2022 18:08:03 by
1.7.2