/*
 * Read Data from DHT. On success the green LED will blink.
 */
bool ReadDHT()
{
  if(dht.readData() /*&& dht1.readData() */ )
  {
    digitalWrite(PIO3_3, !digitalRead(PIO3_3));
    // dht._lastTemperature;
    // dht._lastHumidity;
    // float fDewPoint= dht.CalcdewPointFast( dht._lastTemperature, dht._lastHumidity);
    return true;
  } //else dht._lastError;
  return false;
}
bool ReadTempHum()
{
  bool bRet= dht.readData();
  if(bRet)
  {
    digitalWrite(PIO3_3, !digitalRead(PIO3_3));
#if DBG_PRINT_DHT
    printf("     Temperature: %4.2f C \n", dht._lastTemperature );
    printf("        Humidity: %4.2f\n",dht._lastHumidity);
    printf("       Dew point: %4.2f (FastCalc: %4.2f)\r\n", dht.CalcdewPointFast(dht._lastTemperature, dht._lastHumidity));
    bRet= true;
  } else printf("Err %i \r\n",dht._lastError);
#else
  }
Exemple #3
0
void cmd_sensor(Stream * chp, int argc, char * argv[])
{
	float temperature, humidity;

	
	if (dht.readData() == ERROR_NONE)
  {
		temperature = dht.ReadTemperature(CELCIUS);
		humidity = dht.ReadHumidity();
		
		chp->printf("Temperature %.2fC \r\n", temperature);
    chp->printf("Humidity %.2f%% \r\n", humidity);
		chp->printf("Dew point %.2f\r\n", dht.CalcdewPoint(temperature, humidity));
  }
}