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 #include "mbed.h" 00002 #include "TextLCD.h" 00003 DigitalOut myled(LED1); 00004 00005 DigitalIn first(PA_8); 00006 DigitalIn second(PB_10); 00007 00008 AnalogIn PA0(PA_0); 00009 AnalogIn PA4(PA_4); 00010 00011 Serial pc(SERIAL_TX,SERIAL_RX); 00012 00013 void affiche_temperature(); 00014 void affiche_pression(); 00015 00016 TextLCD lcd(PC_7, PA_7, PA_6, PA_5, PB_9, PB_8); 00017 00018 00019 int main() { 00020 00021 00022 lcd.printf(" Hello World! \n"); 00023 wait(2); 00024 lcd.cls(); 00025 while(1){ 00026 if ((first==1)&&(second==0)) affiche_temperature(); 00027 //if(first==1) ; 00028 else if ((first==0)&&(second==1)) affiche_pression(); 00029 else 00030 { 00031 lcd.printf("which value u want to know"); 00032 wait(1); 00033 lcd.cls(); 00034 lcd.printf("1. Temperature\n2. Pression\n"); 00035 wait(1); 00036 lcd.cls(); 00037 lcd.printf("3.vitesse\n4.direction\n"); 00038 wait(1); 00039 lcd.cls(); 00040 } 00041 } 00042 00043 00044 00045 00046 } 00047 00048 00049 void affiche_temperature(){ 00050 00051 float value_tem = 0.0; 00052 float temperature = 0.0; 00053 value_tem = PA0.read(); 00054 // lcd.printf("\n \r value_tem = %f", value_tem); 00055 00056 00057 temperature = ((value_tem*3.3f + 0.7815f )/0.01f)- 273.15f; 00058 lcd.printf(" T= %.2f C\n", temperature); 00059 00060 wait(2); 00061 lcd.cls(); 00062 00063 } 00064 00065 void affiche_pression(){ 00066 float value_pre = 0.0; 00067 float pression = 0.0; 00068 value_pre = PA4.read(); 00069 // lcd.printf("\n \r value_pre= %f", value_pre); 00070 00071 00072 pression = (((value_pre *3.3f + 0.0902f)/3.3f ) + 0.095f) / 0.009f; 00073 lcd.printf(" P = %.2f kPa", pression); 00074 00075 wait(3); 00076 lcd.cls(); 00077 00078 }
Generated on Tue Sep 13 2022 13:51:29 by
1.7.2