I'm on an Arduino UNO, and my temp sensor is DHT11. I ran this code:
const int sensorPin = A5;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int sensorVal = analogRead(sensorPin);
Serial.print("Sensor Value: ");
Serial.print(sensorVal);
float voltage = (sensorVal/1024.0) * 5.0;
Serial.print(", Volts: ");
Serial.print(voltage);
float temperature = (voltage - .5) * 100;
Serial.print(", degrees C: ");
Serial.println(temperature);
delay(1000);
}
But my output wasn't something normal like 20C, it was Sensor Value: 1023, Volts: 5.00, degrees C: 449.51, I tried changing the jumper wires, changing its position on the breadboard. I tried running some other code that was from the Arduino Projects Book, and I still got wrong numbers. Does anyone know how to fix that?
