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.
Test_baseboard.cpp
00001 #include "mbed.h" //bibliothèque Mbed 00002 #include "TextLCD.h" 00003 00004 00005 //Serial pc(USBTX, USBRX); //tx,rx pc est un objet de la classe 00006 DigitalOut myled(LED1); 00007 DigitalOut myled2(LED2); 00008 DigitalOut myled3(LED3); 00009 DigitalOut myled4(LED4); 00010 AnalogIn period(p20); 00011 DigitalOut buzz(p24); 00012 //int buzz; 00013 InterruptIn button(p11); 00014 PwmOut pTest(p26); 00015 00016 00017 TextLCD lcd(p14,p19,p25,p23,p22,p21); //rs, e, d4-d7 00018 00019 00020 float delayed=0.01; 00021 00022 void davLed(int f){ 00023 if( f==0) myled=0; 00024 if( f==1) myled=1; 00025 if( f==3){ 00026 delayed=0.01+period; 00027 myled = 1; 00028 myled2 = 0; 00029 myled3 = 0; 00030 myled4 = 0; 00031 delayed=0.01+period; 00032 wait(delayed); 00033 myled2 = 1; 00034 myled = 0; 00035 00036 delayed=0.01+period; 00037 wait(delayed); 00038 myled2 = 0; 00039 myled3 = 1; 00040 delayed=0.01+period; 00041 wait(delayed); 00042 myled3 = 0; 00043 myled4 = 1; 00044 delayed=0.01+period; 00045 wait(delayed); 00046 lcd.cls(); 00047 lcd.printf("Periode= %.2f s",delayed); 00048 } 00049 } 00050 void flip(){ 00051 int bip=buzz; 00052 00053 if(bip==1){ 00054 buzz=0; 00055 }else{ 00056 buzz=1; 00057 } 00058 } 00059 00060 00061 int main() { 00062 // int i=0; 00063 // int c=0; 00064 00065 //pc.baud(115200); // débit en bauds 00066 //pc.printf("MBDE\r\n"); 00067 buzz=1; 00068 pTest.period_us(1); 00069 lcd.printf("Test\n"); 00070 wait(0.5); 00071 while(1){ 00072 button.fall(&flip); 00073 pTest.write(period); 00074 00075 //pc.printf("%d\r\n",i); 00076 //i++; 00077 //wait(1.0); 00078 /*if(pc.readable()){ 00079 c=pc.getc(); 00080 if(c=='0'){davLed(0);} 00081 00082 if(c=='1'){davLed(1);} 00083 if(c=='3'){davLed(3);}*/ 00084 00085 davLed(3); 00086 } 00087 00088 00089 00090 }
Generated on Thu Jul 14 2022 02:47:22 by
1.7.2