I keep getting the wrong voltage. It should be about 2.11 volts but it shows .42 volts. I am using the 8MHz internal clock on the atmega328 non-picopower model. What is going on?
EDIT:
Here's my code:
// Configuration:
// 5v------10k-------Sensor------GND
// |
// Analog
void setup()
{
Serial.begin(9600*2); //Start the serial connection with the computer
}
float getTemp() {
float aread = analogRead(0) / 1024.0; // calculate voltage
Serial.println(aread); // print voltage
float resistance = 330.0 / (5.0 / aread - 1.0); // calculate resistance of sensor
Serial.println(resistance); // print resistance
float temp = 46 / pow(resistance, .40984); // calculate temperature with resistance
Serial.println(temp); // print temp
return temp;
}
void loop()
{
getTemp();
delay(1000);
}