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 |
Diff: main.cpp
- Revision:
- 0:6e109b79e249
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu May 12 10:16:22 2016 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +#include "ADT7410.h" + +ADT7410 sensor(I2C_SDA, I2C_SCL); +DigitalOut led1(LED1); + +int main() { + float temp; + + printf("Sensor start!\n"); + led1 = 1; + while(1) { + temp = sensor.temp_value(); + printf("Temperature = %2.2f\n",temp); + led1 = !led1; + wait_ms(250); + } +}