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 TextLCD mbed
Fork of mbed_AM2321 by
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 "AM2321.h" 00013 #include "TextLCD.h" 00014 00015 //#pragma O0 00016 //#pragma O1 00017 //#pragma O2 // default 00018 //#pragma O3 00019 //#pragma Otime 00020 //#pragma Ospace 00021 00022 00023 #if defined(TARGET_LPC1768) 00024 DigitalOut led1(LED1); 00025 DigitalOut led2(LED2); 00026 I2C i2c(p28,p27); 00027 #endif 00028 // for TG-LPC11U35-501 00029 #if defined(TARGET_LPC11U35_501) 00030 DigitalOut led1(P0_20); 00031 DigitalOut led2(P0_21); 00032 I2C i2c(P0_5,P0_4); 00033 #endif 00034 // for Nucleo 00035 #if defined(TARGET_NUCLEO_F401RE) 00036 DigitalOut led1(D13); 00037 I2C i2c(D14,D15); 00038 #endif 00039 00040 AM2321 am2321(i2c); 00041 TextLCD lcd(p21, p22, p23, p24, p25, p26); // rs, e, d4-d7 00042 00043 int main() { 00044 00045 char msg[10]; 00046 int h; 00047 int t; 00048 00049 while(1) { 00050 00051 h = am2321.humidity(); 00052 sprintf(msg,"%4.1f%%",h/10.0); 00053 lcd.locate(0,0); 00054 lcd.printf(msg); 00055 00056 t = am2321.temperature(); 00057 sprintf(msg,"%4.1fC",t/10.0); 00058 lcd.locate(0,1); 00059 lcd.printf(msg); 00060 00061 wait(1); 00062 } 00063 00064 }
Generated on Fri Jul 22 2022 22:11:43 by
1.7.2
