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: BSP_DISCO_F746NG LCD_DISCO_F746NG mbed
main.cpp
00001 #include "mbed.h" 00002 #include "LCD_DISCO_F746NG.h" 00003 00004 DigitalOut ledRE(D2); 00005 DigitalOut ledGR(D7); 00006 DigitalOut ledBL(D6); 00007 DigitalOut ledIND(LED4); 00008 DigitalIn button(D3); 00009 LCD_DISCO_F746NG lcd; 00010 AnalogIn tempCalc(A0); 00011 00012 int main() { 00013 button.mode(PullUp); 00014 int prevValue = 0; 00015 //printf("Data transfer complete.\n"); 00016 00017 while(1) { 00018 float temp = tempCalc.read()*27.21; 00019 printf("%f\n", temp); 00020 char result[18]; 00021 snprintf(result, sizeof(result), "Current temp %f", temp); 00022 wait(0.1); 00023 if (button == 1 && prevValue == 0){ 00024 if (ledRE == 1 && ledGR == 1 && ledBL && ledIND){ 00025 00026 lcd.Clear(LCD_COLOR_BLACK); 00027 00028 ledIND = 0; 00029 wait(0.2); 00030 ledBL = 0; 00031 wait(0.2); 00032 ledGR = 0; 00033 wait(0.2); 00034 ledRE = 0; 00035 } 00036 else { 00037 00038 lcd.SetBackColor(LCD_COLOR_BLACK); 00039 lcd.SetTextColor(LCD_COLOR_WHITE); 00040 wait(0.2); 00041 lcd.DisplayStringAt(0, LINE(5), (uint8_t *)result, CENTER_MODE); 00042 00043 00044 00045 ledIND = 1; 00046 wait(0.2); 00047 ledBL = 1; 00048 wait(0.2); 00049 ledGR = 1; 00050 wait(0.2); 00051 ledRE = 1; 00052 } 00053 prevValue = 1; 00054 } 00055 else if (button == 0){ 00056 prevValue = 0; 00057 } 00058 00059 } 00060 }
Generated on Thu Aug 11 2022 18:38:27 by
1.7.2