Arduino clock with temperature e.t.c

Trying to build my first project. MQ2 gas sensor + JY-MCU clock+DHT22+LCD display
Everything is fine. But as soon as i uncomment the code in question arduino slows down to a crawl as the LCD display starts to refresh once in 4 seconds and redrawing can be seen.
This is the code

#include <U8glib.h>
#include "Wire.h"
#define DS1307_ADDRESS 0x68
#include "DHT.h"
#define DHTPIN 5
#define DHTTYPE DHT22

U8GLIB_ST7920_128X64 u8g(4, 8, 7, U8G_PIN_NONE);
int sensorPin = A1;    // select the input pin for the potentiometer
int sensorValue = 0;  // variable to store the value coming from the sensor
void setup()
  u8g.setColorIndex(1); // pixel on

byte bcdToDec(byte val)  {
// Convert binary coded decimal to normal decimal numbers
return ( (val/16*10) + (val%16) );
void loop()
sensorValue = analogRead(sensorPin);
//float hem=dht.readHumidity();
//float tem=dht.readTemperature();

  byte zero = 0x00;
  Wire.requestFrom(DS1307_ADDRESS, 7);
  int second = bcdToDec(;
  int minute = bcdToDec(;
  int hour = bcdToDec( & 0b111111); //24 hour time
  int weekDay = bcdToDec(; //0-6 -> sunday - Saturday
  int monthDay = bcdToDec(;
  int month = bcdToDec(;
  int year = bcdToDec(;
  u8g.setPrintPos(15, 20); 
  u8g.setPrintPos(1, 35);
/*  u8g.setPrintPos(1, 50);


It's hardly necessary to read the temp and humidity every pass through loop(). I suspect once every 5 seconds or 5 minutes would be enough.


Got it. Problem solved by putting the code lines out of u8g.firstPage(); function

The DHT can only return a new reading every two seconds, so there is no point reading more often than that. It just returns the last valid reading anyway if you try to read faster. Plus it has a 250 mS delay built in for each reading.