[md]
# HDC1080
HDC这名字总让我觉得有点山寨,一个传感器写个1080也挺奇怪的。但实际这个传感器是TI出的
## 硬件&接入方式
开发板使用esp8266开发板,接入方式为WiFi接入
HDC1080支持使用IIC通信,传感器连接到开发板IIC接口即可
## 驱动库
https://github.com/closedcube/ClosedCube_HDC1080_Arduino
## 示例程序
```
#define BLINKER_WIFI
#include <Blinker.h>
char auth[] = "xxxxxxxxxxxx";
char ssid[] = "xxxxxx";
char pswd[] = "xxxxxx";
BlinkerNumber TEMP("temp"); // Temperature
BlinkerNumber HUMI("humi"); // Humidity
// Download Adafruit-BMP085-Library library here:
// https://github.com/closedcube/ClosedCube_HDC1080_Arduino
#include <Wire.h>
#include <ClosedCube_HDC1080.h>
ClosedCube_HDC1080 hdc1080;
void dataRead(const String & data)
{
BLINKER_LOG("Blinker readString: ", data);
Blinker.vibrate();
uint32_t BlinkerTime = millis();
Blinker.print("millis", BlinkerTime);
}
void heartbeat()
{
TEMP.print(hdc1080.readTemperature());
HUMI.print(hdc1080.readHumidity());
}
void setup()
{
Serial.begin(115200);
BLINKER_DEBUG.stream(Serial);
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
Blinker.begin(auth, ssid, pswd);
Blinker.attachData(dataRead);
Blinker.attachHeartbeat(heartbeat);
hdc1080.begin(0x40);
}
void loop()
{
Blinker.run();
}
```
[/md] |