Hi everyone, its my fisrt topic here, so hopefully im using the right section for this.
Im usign a DHT11 to measure temperature and humidity with an arduino uno. I wrote a code just to print both temperature and humidity in the serial port, and everything works great.
After connecting a XBee shield on the arduino, I keep getting no data from the sensor when I try reading it. The code is the same, the connections are the same, the only thing I added was the shield. Anyone knows what might be causing this? I´ve searched online for a couple hours and couldn´t find a solution. I appreciate any help!
Here is the code:
#include <SimpleDHT.h>
#include <DHT.h>
int pinDHT11 = 8;
SimpleDHT11 dht11;
int valores = 0;
void setup() {
//Define o pino 2 como entrada - Dados do sensor de umidade
pinMode(pinDHT11, INPUT);
Serial.begin(9600);
Serial.println("Setup Inicial");
}
void loop() {
DHT11_Measure();
delay(2000);
}
void DHT11_Measure() {
// read with raw sample data.
byte temperature = 0;
byte humidity = 0;
byte data[40] = {0};
if (dht11.read(pinDHT11, &temperature, &humidity, data)) {
Serial.print("Read DHT11 failed");
return;
}
Serial.println("");
Serial.print("Temperatura: ");
Serial.print((float)temperature); Serial.println(" *C, ");
Serial.print("Umidade: ");
Serial.print((float)humidity); Serial.println(" %");
}
THANKS FOR YOUR ATTENTION!!