ADT7410 Temperature Sensor sample.
About ADT7410
ADT7410 is a temperature sensor and can be controlled by using the I2C.
- Datasheet of ADT7410
http://www.analog.com/media/en/technical-documentation/data-sheets/ADT7410.pdf
About sample program
This program outputs temperature data.
In order to run I2C communication with connecting GR-PEACH and the sensor, you will need to pull up.
Short jumper of GR-PEACH, leakage solder in two places of "PU" of the sensor base, or, add with the external resistor (10KΩ).
About wiring
Sensor | GR-PEACH |
VDD | 3.3V |
GND | GND |
SCL | D15 |
SDA | D14 |
ADT7410.h@0:6e109b79e249, 2016-05-12 (annotated)
- Committer:
- 1050186
- Date:
- Thu May 12 10:16:22 2016 +0000
- Revision:
- 0:6e109b79e249
first commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
1050186 | 0:6e109b79e249 | 1 | #ifndef ADT7410_H_ |
1050186 | 0:6e109b79e249 | 2 | #define ADT7410_H_ |
1050186 | 0:6e109b79e249 | 3 | |
1050186 | 0:6e109b79e249 | 4 | #include "mbed.h" |
1050186 | 0:6e109b79e249 | 5 | |
1050186 | 0:6e109b79e249 | 6 | #define ADT7410_I2C_ADDR 0x90 |
1050186 | 0:6e109b79e249 | 7 | #define ADT7410_TMPH_ADDR 0x00 |
1050186 | 0:6e109b79e249 | 8 | #define ADT7410_CFG_ADDR 0x03 |
1050186 | 0:6e109b79e249 | 9 | |
1050186 | 0:6e109b79e249 | 10 | class ADT7410 { |
1050186 | 0:6e109b79e249 | 11 | public: |
1050186 | 0:6e109b79e249 | 12 | ADT7410(PinName sda, PinName scl); |
1050186 | 0:6e109b79e249 | 13 | |
1050186 | 0:6e109b79e249 | 14 | void send(char data_0, char data_1); |
1050186 | 0:6e109b79e249 | 15 | void recv(char data); |
1050186 | 0:6e109b79e249 | 16 | float temp_value(); |
1050186 | 0:6e109b79e249 | 17 | |
1050186 | 0:6e109b79e249 | 18 | protected: |
1050186 | 0:6e109b79e249 | 19 | I2C i2c; |
1050186 | 0:6e109b79e249 | 20 | |
1050186 | 0:6e109b79e249 | 21 | char buf[2]; |
1050186 | 0:6e109b79e249 | 22 | |
1050186 | 0:6e109b79e249 | 23 | }; |
1050186 | 0:6e109b79e249 | 24 | |
1050186 | 0:6e109b79e249 | 25 | #endif /* ADT7410_H_ */ |