AM2321 library
Dependents: mbed_AM2321_copy mbed_AM2321
See http://developer.mbed.org/users/yasuyuki/notebook/AM2321/
AM2321.h@0:3656aea4e6f6, 2014-10-08 (annotated)
- Committer:
- yasuyuki
- Date:
- Wed Oct 08 02:48:36 2014 +0000
- Revision:
- 0:3656aea4e6f6
- Child:
- 1:39f20504d5c5
first release
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
yasuyuki | 0:3656aea4e6f6 | 1 | //********************** |
yasuyuki | 0:3656aea4e6f6 | 2 | // AM2321.h for mbed |
yasuyuki | 0:3656aea4e6f6 | 3 | // |
yasuyuki | 0:3656aea4e6f6 | 4 | // (C)Copyright 2014 All rights reserved by Y.Onodera |
yasuyuki | 0:3656aea4e6f6 | 5 | // http://einstlab.web.fc2.com |
yasuyuki | 0:3656aea4e6f6 | 6 | //********************** |
yasuyuki | 0:3656aea4e6f6 | 7 | #ifndef AM2321_H_ |
yasuyuki | 0:3656aea4e6f6 | 8 | #define AM2321_H_ |
yasuyuki | 0:3656aea4e6f6 | 9 | |
yasuyuki | 0:3656aea4e6f6 | 10 | #define AM2321_ADDR 0xB8 |
yasuyuki | 0:3656aea4e6f6 | 11 | #define AM2321_HUM_H 0x00 |
yasuyuki | 0:3656aea4e6f6 | 12 | #define AM2321_HUM_L 0x01 |
yasuyuki | 0:3656aea4e6f6 | 13 | #define AM2321_TEMP_H 0x02 |
yasuyuki | 0:3656aea4e6f6 | 14 | #define AM2321_TEMP_L 0x03 |
yasuyuki | 0:3656aea4e6f6 | 15 | |
yasuyuki | 0:3656aea4e6f6 | 16 | #include "mbed.h" |
yasuyuki | 0:3656aea4e6f6 | 17 | #include "typedef.h" |
yasuyuki | 0:3656aea4e6f6 | 18 | |
yasuyuki | 0:3656aea4e6f6 | 19 | class AM2321{ |
yasuyuki | 0:3656aea4e6f6 | 20 | public: |
yasuyuki | 0:3656aea4e6f6 | 21 | AM2321 (PinName sda, PinName scl); |
yasuyuki | 0:3656aea4e6f6 | 22 | AM2321 (I2C& p_i2c); |
yasuyuki | 0:3656aea4e6f6 | 23 | |
yasuyuki | 0:3656aea4e6f6 | 24 | void get(); |
yasuyuki | 0:3656aea4e6f6 | 25 | int humidity(); |
yasuyuki | 0:3656aea4e6f6 | 26 | int temperature(); |
yasuyuki | 0:3656aea4e6f6 | 27 | |
yasuyuki | 0:3656aea4e6f6 | 28 | protected: |
yasuyuki | 0:3656aea4e6f6 | 29 | |
yasuyuki | 0:3656aea4e6f6 | 30 | I2C _i2c; |
yasuyuki | 0:3656aea4e6f6 | 31 | |
yasuyuki | 0:3656aea4e6f6 | 32 | WORD_VAL hum; |
yasuyuki | 0:3656aea4e6f6 | 33 | WORD_VAL temp; |
yasuyuki | 0:3656aea4e6f6 | 34 | char buf[8]; |
yasuyuki | 0:3656aea4e6f6 | 35 | |
yasuyuki | 0:3656aea4e6f6 | 36 | }; |
yasuyuki | 0:3656aea4e6f6 | 37 | |
yasuyuki | 0:3656aea4e6f6 | 38 | #endif /* AM2321_H_ */ |
yasuyuki | 0:3656aea4e6f6 | 39 | |
yasuyuki | 0:3656aea4e6f6 | 40 |