Hello Everyone
I want to use my Arduino Uno with the Adafruit Data Logger Shield (R3 comp.) and a DS18B20 Temperature Sensor.
To test the sensor I use the code below. If i plug the sensor to Pin 10 I get good readings. So I assume the wiring and code are both working fine. However, if I connect the sensor to any other Pin I only get 0°C as result.
Any thoughts what could be wrong? Is there an interference with the logger shield? I tested a bunch of other sensors (dht, photoresistance, capacitive moisture sensor) and they are all working fine on any pin I like. So I really don't know what could cause the problem.
Thanks in advance for your thoughts!!
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 5
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float Celcius=0;
float Fahrenheit=0;
void setup(void)
{
Serial.begin(9600);
sensors.begin();
}
void loop(void)
{
sensors.requestTemperatures();
delay(1000);
Celcius=sensors.getTempCByIndex(0);
Serial.print(" C ");
Serial.print(Celcius);
delay(1000);
}