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.
Dependencies: mbed
Fork of exp4 by
main.cpp
00001 #incmbed.h" 00002 Serial pc(USBTX, USBRX); 00003 BusOut myled(LED1,LED2,LED3,LED4); 00004 AnalogIn Ain(p20); 00005 float ADCdata;lude " 00006 00007 int main() 00008 { 00009 pc.printf("ADC data values \n"); 00010 while(1) 00011 { 00012 ADCdata=Ain; 00013 pc.printf("%f \n",ADCdata); 00014 wait(0.5); 00015 if(ADCdata<=0.2) 00016 { 00017 myled=0; 00018 wait(0.5); 00019 } 00020 else if(ADCdata<=0.4 && ADCdata>0.2) 00021 { 00022 myled=8; 00023 wait(0.5); 00024 } 00025 else if(ADCdata<=0.6 && ADCdata>0.4) 00026 { 00027 myled=12; 00028 wait(0.5); 00029 } 00030 else if(ADCdata<=0.8 && ADCdata>0.6) 00031 { 00032 myled=14; 00033 wait(0.5); 00034 } 00035 else if(ADCdata<=1 && ADCdata>0.8) 00036 { 00037 myled=15; 00038 wait(0.5); 00039 } 00040 } 00041 }
Generated on Sat Jul 30 2022 17:09:54 by
1.7.2
