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: BME280 BMP280 TextLCD mbed
main.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 #include "BMP280.h" 00004 #include "putty.h" 00005 //DigitalOut myled(LED1); 00006 int dislcd = 0; 00007 float T = 15; 00008 Ticker display; 00009 Ticker second_pass; 00010 InterruptIn button(USER_BUTTON); 00011 00012 //NVIC_SetPriority(display, 0); 00013 //NVIC_SetPriority(second_pass, 1); 00014 //NVIC_SetPriority(button, 1); 00015 void second_tick() 00016 { 00017 ss++; 00018 time_rule(); 00019 day_check(); 00020 lcd.cls(); 00021 if (dislcd == 1) 00022 { 00023 lcd.locate(10,0); 00024 lcd.printf("l:%1.2f", lvl); 00025 lcd.locate(0,0); 00026 lcd.printf("p:%3.1f", pressuref); 00027 lcd.locate(10,1); 00028 lcd.printf("t:%3.1f", tempf); 00029 display_time(); 00030 } 00031 00032 else if (dislcd == 0) 00033 { 00034 display_dates(); 00035 display_time(); 00036 } 00037 } 00038 00039 void lcddisp() 00040 { 00041 display_time(); 00042 getdata(); 00043 store(); 00044 } 00045 00046 void check_display() 00047 { 00048 if(dislcd == 0) 00049 {dislcd = 1;} 00050 else 00051 {dislcd = 0;} 00052 } 00053 00054 00055 int main() 00056 { 00057 lcd.cls(); 00058 //display_date_time(); 00059 // while (pointer != 14) 00060 // { 00061 // select_date(); 00062 // } 00063 bmp.initialize(); 00064 pc.printf("putty ready\n\r"); 00065 display.attach(&lcddisp, T); 00066 second_pass.attach(&second_tick, 1.0); 00067 button.rise(&check_display); 00068 00069 00070 while(1) 00071 { 00072 check_display(); 00073 putty_write(); 00074 if (interrupt == 1); 00075 { 00076 T = t; 00077 display.attach(&lcddisp, T); 00078 interrupt =0; 00079 } 00080 check_display(); 00081 } 00082 } 00083 00084 00085
Generated on Tue Jul 19 2022 21:47:04 by
