arduino温湿度传感器代码问题

arduino温湿度传感器代码问题,有没有哪位大神帮我看看我这个代码哪里有问题 dht11函数库也导入了 代码在下面: #include<dht11.h> dht11 …

arduino温湿度传感器代码问题,有没有哪位大神帮我看看我这个代码哪里有问题 dht11函数库也导入了 代码在下面:
#include<dht11.h>
dht11 DHT11;
#define DHT11PIN 2
double dewPiont(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);
  return (241.88 * T) / (17.558 – T);
}
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;
}
void loop()
{
  if (DHT11.temperature >= 40 || hc == ‘w’)
  {
    for (int i = 0; i < 5; i++)
    {
      digitalWrite(SC, HIGH);
      Serial.println(“Warning For Temperature”);
      delay(5000);
      digitalWrite(SC, LOW);
      Serial.println(“Warning For Temperature”);
      delay(5000);
    }
  }
  if (DHT11.humidity <= 20 || hc == ‘r’)
  {
    for (int i = 0; i < 5; i++)
    {
      digitalWrite(RED, HIGH);
      Serial.println(“Warning For Humidity”);
      delay(3000);
      digitalWrite(RED, LOW);
      Serial.println(“Warning For Humidity”);
      delay(3000);
    }
  }
}

作者: soufei

为您推荐


Fatal error: Can't use function return value in write context in /www/wwwroot/www.qianrushi.com.cn/wp-content/themes/news/footer.php on line 115