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: AM2321 AQM0802 mbed
main.cpp
00001 //********************** 00002 // Hygrometer and Thermometer for mbed 00003 // 00004 // LPC1768 flash=512KB, ADC=12bits 00005 // LPC11U35 flash=64KB, ADC=10bits 00006 // Nucleo ADC=12bits 00007 // 00008 // (C)Copyright 2014 All rights reserved by Y.Onodera 00009 // http://einstlab.web.fc2.com 00010 //********************** 00011 #include "mbed.h" 00012 #include "AQM0802.h" 00013 #include "AM2321.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 AM2321 am2321(i2c); 00029 00030 int main() { 00031 00032 char msg[10]; 00033 int h; 00034 int t; 00035 00036 while(1) { 00037 00038 h = am2321.humidity(); 00039 sprintf(msg,"%4.1f%% ",h/10.0); 00040 lcd.locate(0,0); 00041 lcd.print(msg); 00042 00043 t = am2321.temperature(); 00044 sprintf(msg,"%4.1fC ",t/10.0); 00045 lcd.locate(0,1); 00046 lcd.print(msg); 00047 00048 wait(1); 00049 } 00050 00051 }
Generated on Tue Jul 12 2022 23:18:12 by
1.7.2