1 Reply Latest reply on Apr 29, 2014 8:54 AM by AlexT_Intel

    Why  DHT works well with Arduino board, but shows error message with Galileo

    Wang_Xin

      I am doing a small project which needs a temperature and humidity sensor to give some feedback to my system. I bought  DHT11 sensor, and create a code which refers to Www.Arduino.CC example sketch. I upload it on an Arduino board first, it works well. but it shows error message "Time out error" when I upload the sketch to Galileo board. The pins which I used are as same as the other board. Is there anyone see such problem before? Would you let me know how to solve it? Thank you so much!

       

       

       

      =============My code is like this, removed some codes not related to DHT11========================

      #include <dht11.h>

      #define DHT11_PIN 7 // Set DIgtal Pin7 as DTH11 output

       

      float dhtHumidity = 99.9;

      float dhtTemperature = 99.9;

       

      void setup()

      {

        Serial.println("...start...");

      ...// remove some codes not related to DHT11

      }

       

      void loop()

      {

      ..// remove some codes not related to DHT11

      DHT11sensor();

      ...// remove some codes not related to DHT11

      }

       

      //----------------------------------------------------------- End DHT11sensor()

      void DHT11sensor()

      {

      int chk;

        Serial.print("DHT11 start... \t");

        chk = DHT.read(DHT11_PIN);    // READ DATA

        switch (chk){

          case DHTLIB_OK:

                      Serial.print("OK,\t");

                      break;

          case DHTLIB_ERROR_CHECKSUM:

                      Serial.print("Checksum error,\t");

                      break;

          case DHTLIB_ERROR_TIMEOUT:

                      Serial.print("Time out error,\t");

                      break;

          default:

                      Serial.print("Unknown error,\t");

                      break;

        }

      // DISPLAT DATA

      dhtHumidity = DHT.humidity;

      dhtTemperature = DHT.temperature;

      Serial.print(DHT.humidity,1);

      Serial.print(",\t");

      Serial.print(DHT.temperature,1);

      delay(100);

      }

      //----------------------------------------------------------- End DHT11sensor()

       

      Attachment is DHT11 manual