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: AQM0802 BME280 mbed
main.cpp
00001 //********************** 00002 // Hygrometer, Thermometer and Pressure for mbed 00003 // 00004 // LPC1768 flash=512KB, ADC=12bits 00005 // LPC11U35 flash=64KB, ADC=10bits 00006 // Nucleo ADC=12bits 00007 // 00008 // (C)Copyright 2015 All rights reserved by Y.Onodera 00009 // http://einstlab.web.fc2.com 00010 //********************** 00011 #include "mbed.h" 00012 #include "AQM0802.h" 00013 #include "BME280.h" 00014 00015 #if defined(TARGET_LPC1768) 00016 I2C i2c(p28,p27); 00017 #endif 00018 // for TG-LPC11U35-501 00019 #if defined(TARGET_LPC11U35_501) 00020 I2C i2c(P0_5,P0_4); 00021 #endif 00022 // for Nucleo 00023 #if defined(TARGET_NUCLEO_F401RE) 00024 I2C i2c(D14,D15); 00025 #endif 00026 00027 AQM0802 lcd(i2c); 00028 BME280 bme280(i2c); 00029 00030 int main() { 00031 00032 char msg[10]; 00033 float h; 00034 float t; 00035 float p; 00036 00037 while(1) { 00038 00039 h = bme280.humidity(); 00040 h = h/1024; 00041 sprintf(msg,"%5.2f%% ",h); 00042 lcd.locate(0,0); 00043 lcd.print(msg); 00044 wait(2); 00045 00046 t = bme280.temperature(); 00047 t = t/100; 00048 sprintf(msg,"%5.2fC ",t); 00049 lcd.locate(0,0); 00050 lcd.print(msg); 00051 wait(2); 00052 00053 p = bme280.pressure(); 00054 p = p/256; 00055 sprintf(msg,"%6.0fPa ",p); 00056 lcd.locate(0,0); 00057 lcd.print(msg); 00058 wait(2); 00059 } 00060 00061 } 00062
Generated on Tue Jul 12 2022 18:34:25 by
1.7.2