极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10356|回复: 1

求助:有人玩过yeelink+arduino+w5100+Dht11吗?

[复制链接]
发表于 2015-10-7 22:11:11 | 显示全部楼层 |阅读模式
编译没问题的,我用com串口能打印出来的,怎么上传不了到yeelink啊?那里有问题了。?


double Fahrenheit(double celsius)
{
        return 1.8 * celsius + 32;
}    //摄氏温度度转化为华氏温度

double Kelvin(double celsius)
{
        return celsius + 273.15;
}     //摄氏温度转化为开氏温度

// 露点(点在此温度时,空气饱和并产生露珠)
// 参考: http://wahiduddin.net/calc/density_algorithms.htm
double dewPoint(double celsius, double humidity)
{
        double A0= 373.15/(273.15 + celsius);
        double SUM = -7.90298 * (A0-1);
        SUM += 5.02808 * log10(A0);
        SUM += -1.3816e-7 * (pow(10, (11.344*(1-1/A0)))-1) ;
        SUM += 8.1328e-3 * (pow(10,(-3.49149*(A0-1)))-1) ;
        SUM += log10(1013.246);
        double VP = pow(10, SUM-3) * humidity;
        double T = log(VP/0.61078);   // temp var
        return (241.88 * T) / (17.558-T);
}

// 快速计算露点,速度是5倍dewPoint()
// 参考: http://en.wikipedia.org/wiki/Dew_point
double dewPointFast(double celsius, double humidity)
{
        double a = 17.271;
        double b = 237.7;
        double temp = (a * celsius) / (b + celsius) + log(humidity/100);
        double Td = (b * temp) / (a - temp);
        return Td;
}

#include <Ethernet.h>
#include <WiFi.h>
#include <SPI.h>
#include <yl_data_point.h>
#include <yl_device.h>
#include <yl_w5100_client.h>
#include <yl_wifi_client.h>
#include <yl_messenger.h>
#include <yl_sensor.h>
#include <yl_value_data_point.h>
#include <yl_sensor.h>
#include <dht11.h>
dht11 DHT11;

#define DHT11PIN 3

//this example reads data from a lm35dz sensor, convert value to degree Celsius
//and then post it to yeelink.net

//replace 2633 3539 with ur device id and sensor id
yl_device ardu(340693);
yl_sensor therm(377445, &ardu);
//replace first param value with ur u-apikey
yl_w5100_client client;
yl_messenger messenger(&client, "6db245cc7e60cd17cd3cfbaf04c88d93", "api.yeelink.net");








void setup()
{
    Serial.begin(9600);  //for output information
  byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xAA};
  Ethernet.begin(mac);
}

void loop()
{
  //int v = analogRead(THERM_PIN);
       // Serial.println(lm35_convertor(v));
   int chk = DHT11.read(DHT11PIN);
   //Serial.println((float)DHT11.temperature);
    yl_value_data_point dp((float)DHT11.temperature);
    therm.single_post(messenger, dp);
    delay(1000);
}
回复

使用道具 举报

发表于 2015-10-8 13:59:58 | 显示全部楼层
估计W5100上网的问题吧,是否可以分步调试,先证明网卡可以工作,网卡可以上Yeelink,再传数据。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-15 19:32 , Processed in 0.065586 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表