[问题] arduino多笔资料回传使用struct

楼主: smallswine (small swine)   2016-08-28 01:45:37
我想请问一下
我使用DHT11温溼度传感器
想写作副程式读取资料
然后在主程式显示
由于return无法回传温度.湿度两个数值
所以我想用 struct 包装起来回传
以下是我目前写出的副程式码 接下来可以怎么撰写
再麻烦了 谢谢
#include <dht11.h>
#define dht_dpin 7
dht11 DHT;
//环境温湿度
int DHTt()
{
DHT.read(dht_dpin);
struct data
{
int humidity;
int temperature;
};
struct data dht = {DHT.humidity,DHT.temperature};
return dht;
}

Links booklink

Contact Us: admin [ a t ] ucptt.com