Display -sensor anomaly .

Hi !

I have a very strange problem I need some help.

I want to made a multy porpuse robot and for it i need some sensor to be connected for my Uno + Dht22(temp and humidyti ) + Hcsr04 (ultrasonic distance sensor)+ Oled 128 x 64 Spi and an analog read via 3 metal probe for conductivity.

When I read the distance sensor and the conductivity sensor and I try to display via Oled all works fine
.

When i added the Dht22 all goese wrong ,instead of executing the mesurments its stuck on the adafruit boot logo again and again
.

When i cuted the oled display function and i sended the results via com3 all sensor works fine.

![|500x252](http://server.myspace-shack.com/d21/all fine.png)

The code is :

#include <SPI.h>                      
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#include "DHT.h"

#define DHTPIN 4     // what digital pin we're connected to

#define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321

// Initialize DHT sensor.
// Note that older versions of this library took an optional third parameter to
// tweak the timings for faster processors.  This parameter is no longer needed
// as the current DHT reading algorithm adjusts itself to work on faster procs.
DHT dht(DHTPIN, DHTTYPE);

int conductivity = 0;
int conductivityPin = A0; //CONDUCTIVITI TESTER PIN

int trigPin = 2;    //Trig - green Jumper
int echoPin = 3;    //Echo - yellow Jumper
long duration, cm, inches;

// If using software SPI (the default case):
#define OLED_MOSI   9 //*D1
#define OLED_CLK   10 //*D0 
#define OLED_DC    11 //*
#define OLED_CS    12 //*
#define OLED_RESET 13 //*rst  

Adafruit_SSD1306 display(OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS); 

void setup() {
 Serial.begin(9600);                       //Generic setup
 Serial.println("DHTxx test!");

 dht.begin();
 pinMode(trigPin, OUTPUT);                 //Distance sensor setup
 pinMode(echoPin, INPUT);
 
 display.begin(SSD1306_SWITCHCAPVCC);      //Oled setup
 display.display();
 display.clearDisplay();
}

void loop() {
 temphtest();
 conductivitytest();
 distancesensor();
 displayoled();
}

void temphtest(){
  
  // Wait a few seconds between measurements.
 delay(1000);

 // Reading temperature or humidity takes about 250 milliseconds!
 // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
 float h = dht.readHumidity();
 // Read temperature as Celsius (the default)
 float t = dht.readTemperature();
 // Read temperature as Fahrenheit (isFahrenheit = true)
 float f = dht.readTemperature(true);

 // Check if any reads failed and exit early (to try again).
 if (isnan(h) || isnan(t) || isnan(f)) {
   Serial.println("Failed to read from DHT sensor!");
   return;
 }

 // Compute heat index in Fahrenheit (the default)
 float hif = dht.computeHeatIndex(f, h);
 // Compute heat index in Celsius (isFahreheit = false)
 float hic = dht.computeHeatIndex(t, h, false);

 Serial.print("Humidity: ");
 Serial.print(h);
 Serial.print(" %\t");
 Serial.print("Temperature: ");
 Serial.print(t);
 Serial.print(" *C ");

}

/********************************************************************************************/

void conductivitytest(){
    conductivity = analogRead(conductivityPin);
    Serial.print("     Conductivitate  ");
    Serial.println(conductivity);
}

/*********************************************************************************************/

void distancesensor(){

 // The sensor is triggered by a HIGH pulse of 10 or more microseconds.
 // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
 digitalWrite(trigPin, LOW);
 delayMicroseconds(5);
 digitalWrite(trigPin, HIGH);
 delayMicroseconds(10);
 digitalWrite(trigPin, LOW);

 // Read the signal from the sensor: a HIGH pulse whose
 // duration is the time (in microseconds) from the sending
 // of the ping to the reception of its echo off of an object.
 pinMode(echoPin, INPUT);
 duration = pulseIn(echoPin, HIGH);

 // convert the time into a distance
 cm = (duration/2) / 29.1;
 inches = (duration/2) / 74; 
 
 Serial.print(inches);
 Serial.print("in, ");
 Serial.print(cm);
 Serial.print("cm");
 Serial.println();
 delay(10);
}

/*********************************************************************************************/

void displayoled(){

 display.clearDisplay();
 display.setTextSize(2);
 display.setTextColor(WHITE);
 display.setCursor(0,0);
 display.println("DISTANCE:");
 display.setTextColor(BLACK, WHITE); // 'inverted' text
 //display.println(3.141592);
 display.setTextSize(2);
 display.setTextColor(WHITE);
 display.print(cm, DEC); display.print(" cm");

 display.setTextSize(1);
 display.println("");
 display.println("");
 display.println("CONDUCTIVITY :");
 display.setTextSize(2);
 display.print(conductivity, DEC);display.setTextSize(2);display.print(" UR");
 
 display.display();
 delay(20);
 }

Hi cant see to pictures,

if you can share the connections it would be nice,

Right, first things first.

Go and read the instructions, then go back and modify your post (use the "More --> Modify" option to the bottom right of the post) to mark up the code as such so we can examine it conveniently and accurately.