okay I cant figure this out. I know i had this sensor working with the arduino at one point.
I have my circuit set up just like this: https://lh6.googleusercontent.com/-RsfzgB4YwGk/TXoz9VYShII/AAAAAAAAAFk/KQ5fouPUASA/s1600/Untitled%2BSketch_bb2.png
My code is
//initializes/defines the output pin of the LM335 temperature sensor
int outputpin= 0;
//this sets the ground pin to LOW and the input voltage pin to high
void setup()
{
Serial.begin(9600);
}
//main loop
void loop()
{
int rawvoltage= analogRead(outputpin);
float millivolts= (rawvoltage/1024.0) * 5000;
float kelvin= (millivolts/10);
Serial.print(kelvin);
Serial.println(" degrees Kelvin");
float celsius= kelvin - 273.15;
Serial.print(celsius);
Serial.println(" degrees Celsius");
float fahrenheit= ((celsius * 9)/5 +32);
Serial.print(fahrenheit);
Serial.println(" degrees Fahrenheit");
delay(3000);
}
output:
43.46 degrees Kelvin
-229.69 degrees Celsius
-381.45 degrees Fahrenheit
I dont know why this isn't working. I've tried many programs none of them seem to work. I dont know what im doing wrong.