bodtx:
This library works on Attiny 85 @8mhz and a DHT22 .
Arduino Playground - DHTLib
you have to create manually the .h and .cpp as described at the end of the page.
//
// FILE: dht_test.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.07
// PURPOSE: DHT Temperature & Humidity Sensor library for Arduino
// URL: Arduino Playground - DHTLib
//
// Released to the public domain
//
#include <dht.h>
#include <SoftwareSerial.h>
dht DHT;
#define DHT22_PIN 0
#define rxPin 2
#define txPin 3
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
mySerial.begin(9600);
mySerial.println("DHT TEST PROGRAM ");
mySerial.print("LIBRARY VERSION: ");
mySerial.println(DHT_LIB_VERSION);
mySerial.println();
mySerial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
}
void loop()
{
// READ DATA
mySerial.print("DHT22, \t");
int chk = DHT.read22(DHT22_PIN);
switch (chk)
{
case DHTLIB_OK:
mySerial.print("OK,\t");
break;
case DHTLIB_ERROR_CHECKSUM:
mySerial.print("Checksum error,\t");
break;
case DHTLIB_ERROR_TIMEOUT:
mySerial.print("Time out error,\t");
break;
default:
mySerial.print("Unknown error,\t");
break;
}
// DISPLAY DATA
mySerial.print(DHT.humidity, 1);
mySerial.print(",\t");
mySerial.println(DHT.temperature, 1);
delay(1000);
}
//
// END OF FILE
//
I am not able to run the library with Attiny, I give compilation error.
" Arduino:1.6.3 (Windows XP), Placa:"ATtiny, ATtiny85, 8 MHz (internal)"
In file included from dht_test.ino:1:0:
C:\Documents and Settings\R2Yum\Mis documentos\Arduino\libraries\dht_Attiny/dht.h:64:2: error: #endif without #if
#endif
^
In file included from dht_test.ino:13:0:
C:\Documents and Settings\R2Yum\Mis documentos\Arduino\libraries\dht_Attiny/dht.h:64:2: error: #endif without #if
#endif
^
"
^
I have arduino IDE 1.6.3