Condensation Monitor Measure the current environment condition at outside and inside and make caution or warnings related to condensation. 結露モニタ 屋内外の環境情報を計測し、結露に関する警告あるいは注意を出力します。
Dependencies: BME280 HDC1000 VaporCondition mbed AQM0802
Fork of mbed_HDC1000 by
main.cpp@0:6434ef883399, 2015-01-28 (annotated)
- Committer:
- yasuyuki
- Date:
- Wed Jan 28 08:56:47 2015 +0000
- Revision:
- 0:6434ef883399
- Child:
- 1:1cf4309871b7
release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yasuyuki | 0:6434ef883399 | 1 | //********************** |
yasuyuki | 0:6434ef883399 | 2 | // Hygrometer and Thermometer for mbed |
yasuyuki | 0:6434ef883399 | 3 | // |
yasuyuki | 0:6434ef883399 | 4 | // LPC1768 flash=512KB, ADC=12bits |
yasuyuki | 0:6434ef883399 | 5 | // LPC11U35 flash=64KB, ADC=10bits |
yasuyuki | 0:6434ef883399 | 6 | // Nucleo ADC=12bits |
yasuyuki | 0:6434ef883399 | 7 | // |
yasuyuki | 0:6434ef883399 | 8 | // (C)Copyright 2015 All rights reserved by Y.Onodera |
yasuyuki | 0:6434ef883399 | 9 | // http://einstlab.web.fc2.com |
yasuyuki | 0:6434ef883399 | 10 | //********************** |
yasuyuki | 0:6434ef883399 | 11 | #include "mbed.h" |
yasuyuki | 0:6434ef883399 | 12 | #include "AQM0802.h" |
yasuyuki | 0:6434ef883399 | 13 | #include "HDC1000.h" |
yasuyuki | 0:6434ef883399 | 14 | |
yasuyuki | 0:6434ef883399 | 15 | #if defined(TARGET_LPC1768) |
yasuyuki | 0:6434ef883399 | 16 | I2C i2c(p28,p27); |
yasuyuki | 0:6434ef883399 | 17 | #endif |
yasuyuki | 0:6434ef883399 | 18 | // for TG-LPC11U35-501 |
yasuyuki | 0:6434ef883399 | 19 | #if defined(TARGET_LPC11U35_501) |
yasuyuki | 0:6434ef883399 | 20 | I2C i2c(P0_5,P0_4); |
yasuyuki | 0:6434ef883399 | 21 | #endif |
yasuyuki | 0:6434ef883399 | 22 | // for Nucleo |
yasuyuki | 0:6434ef883399 | 23 | #if defined(TARGET_NUCLEO_F401RE) |
yasuyuki | 0:6434ef883399 | 24 | I2C i2c(D14,D15); |
yasuyuki | 0:6434ef883399 | 25 | #endif |
yasuyuki | 0:6434ef883399 | 26 | |
yasuyuki | 0:6434ef883399 | 27 | AQM0802 lcd(i2c); |
yasuyuki | 0:6434ef883399 | 28 | HDC1000 hdc1000(i2c); |
yasuyuki | 0:6434ef883399 | 29 | |
yasuyuki | 0:6434ef883399 | 30 | int main() { |
yasuyuki | 0:6434ef883399 | 31 | |
yasuyuki | 0:6434ef883399 | 32 | char msg[10]; |
yasuyuki | 0:6434ef883399 | 33 | float h; |
yasuyuki | 0:6434ef883399 | 34 | float t; |
yasuyuki | 0:6434ef883399 | 35 | |
yasuyuki | 0:6434ef883399 | 36 | while(1) { |
yasuyuki | 0:6434ef883399 | 37 | |
yasuyuki | 0:6434ef883399 | 38 | h = hdc1000.humidity(); |
yasuyuki | 0:6434ef883399 | 39 | h = h/0x10000*100; |
yasuyuki | 0:6434ef883399 | 40 | sprintf(msg,"%4.1f%% ",h); |
yasuyuki | 0:6434ef883399 | 41 | lcd.locate(0,0); |
yasuyuki | 0:6434ef883399 | 42 | lcd.print(msg); |
yasuyuki | 0:6434ef883399 | 43 | |
yasuyuki | 0:6434ef883399 | 44 | t = hdc1000.temperature(); |
yasuyuki | 0:6434ef883399 | 45 | t = t/0x10000*165-40; |
yasuyuki | 0:6434ef883399 | 46 | sprintf(msg,"%4.1fC ",t); |
yasuyuki | 0:6434ef883399 | 47 | lcd.locate(0,1); |
yasuyuki | 0:6434ef883399 | 48 | lcd.print(msg); |
yasuyuki | 0:6434ef883399 | 49 | |
yasuyuki | 0:6434ef883399 | 50 | wait(1); |
yasuyuki | 0:6434ef883399 | 51 | } |
yasuyuki | 0:6434ef883399 | 52 | |
yasuyuki | 0:6434ef883399 | 53 | } |