DHT22 humidity Ethernet ENC28J60 client - without delay()

Hi, I am trying to build very simple weather station. I have DHT22 temperature and humidity sensor and Ethernet module.
Fo ethernet I use ethercard librarary. For DHT22 I try Arduino-DHT22 and DHT-sensor-library.
When I call delay() function Ethernet stop working and I must restart Atmega328. I have timer in code based on BlinkWithoutDelay but when my code run DHT code (both libraries) Ethernet stop working. I look at DHT libraries code and there are delay functions and timers like BlinkWithoutDelay.
I would like to read temeprature and humidity every 60 seconds. Is it possible to use DHT without delay?

Thank you for help.

are you steel developing this project?

it can help you… :slight_smile:

// Sample code to set a second and a minute interval
// whit this code you can make any delay without the delay(); function

// Renato M Falarz [<0>]

unsigned long counter = 1000; // this is the variable for 1 second
byte timer = 60; // this is the variable for 1 minute

void setup(){
Serial.begin(9600);
}

void loop(){

if (millis() >= counter){ // compare with arduino internal timer
counter = millis() + 1000; // pointer the conter to the next second
Serial.println(“1 SEC”);
timer++; // increment the minute timer
// stufs to do every second

}

if (timer > 59){ // when timer reach 60 seconds
timer = 0; // set timer to 0 again
Serial.println(“60 Seconds”);
// stufs to do every minute

}
//end
}

Or you can do it like this:

long last_millis = 0;

void loop()
{
unsigned long now_millis = millis();
if(now_millis - last_millis > 60000)
{
last_millis = now_millis;
// do something every minute
}
}

where 60,000 is your interval (in this case 1 minute)

It takes 2500 mS to refresh a DHT22 sensor reading.. So it looks like you have some more homework to do..

Doc