Go Down

Topic: DHT11, support for Arduino Zero (Read 744 times) previous topic - next topic

MRMRM

Hi, sorry for my english, but it's not my native language.

I'm trying to connect DHT11 (temperature/humidity sensor) to my Arduino Zero. I've downloaded library from http://playground.arduino.cc/Main/DHTLib (version 0.1.13, last stable), and connected all wires (blue - gnd, red - 3,3V, green - digital pin):




Next, i uploaded code from library example:

//
//    FILE: dht_read_test.ino
//  AUTHOR: Rob Tillaart
// VERSION: 0.1.00
// PURPOSE: DHT library test sketch for DHTlib read function && Arduino
//     URL:
//
// Released to the public domain
//

#include "dht11.h"

dht DHT;

#define DHT_PIN 2

void setup()
{
    SerialUSB.begin(9600);
    SerialUSB.println("DHT TEST PROGRAM ");
    SerialUSB.print("LIBRARY VERSION: ");
    SerialUSB.println(DHT_LIB_VERSION);
    SerialUSB.println();
    SerialUSB.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)\tTime (us)");
}

void loop()
{
    // READ DATA
    SerialUSB.print("DHT read(), \t");

    uint32_t start = micros();
    int chk = DHT.read11(DHT_PIN);
    uint32_t stop = micros();

    switch (chk)
    {
    case DHTLIB_OK:
        SerialUSB.print("OK,\t");
        break;
    case DHTLIB_ERROR_CHECKSUM:
        SerialUSB.print("Checksum error,\t");
        break;
    case DHTLIB_ERROR_TIMEOUT:
        SerialUSB.print("Time out error,\t");
        break;
    default:
        SerialUSB.print("Unknown error,\t");
        break;
    }
    // DISPLAY DATA
    SerialUSB.print(DHT.humidity, 1);
    SerialUSB.print(",\t");
    SerialUSB.print(DHT.temperature, 1);
    SerialUSB.print(",\t");
    SerialUSB.print(stop - start);
    SerialUSB.println();

    delay(2000);
}
//
// END OF FILE
//


But that's not working. On serial monitor i see this:

DHT read(),    Time out error,   -999.0,   -999.0,   29610

I tried all libraries, but nothing want work (everywhere I see timeout). I think, it's no support for Arduino Zero problem. Anybody can help me?

Go Up