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()

//main loop
void loop()
int rawvoltage= analogRead(outputpin);
float millivolts= (rawvoltage/1024.0) * 5000;
float kelvin= (millivolts/10);
Serial.println(" degrees Kelvin");

float celsius= kelvin - 273.15;
Serial.println(" degrees Celsius");

float fahrenheit= ((celsius * 9)/5 +32);
Serial.println(" degrees Fahrenheit");



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.

Im trying to get it to read the temperature and its a LM335 temp sensor.

Hold your finger on the sensor. Does the measured temperature increase, or stay the same?

BTW, it's good form to post a datasheet when you're asking about a specific part.

it seems to -232 to -233 when i hold the sensor.

k will i give up this is too much work.

venturejordi: //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

I'm glad you put in the comments. They give me a starting point.

As I understand it, this statement creates a variable name 'outputpin' and assigns the value of 0 to it. It does not assign the variable name 'outputpin' to the microprocessor's analog 0 pin, which is what I assume you want to do.

Also, although I haven't got to Analog pins yet, digital need to be assigned a data flow direction in the Setup Function, with the pinMode Function, or am I mistaken about this?

Anyway, you have to let Arduino that it is a pin, what pin it is, and whether it is a data source or data sink before you can use it for anything. With my limited knowledge, it looks like what you have actually done is: 1. Create an address of a block of memory large enough to hold an Integer. 2. When you create it you put a 0 in it. 3. You then attempt to read data from it (even though the variable name suggests it is for output) using the analogRead Function. I'm surprised you don't get an error from that. 4. Then you assign the 'returned' value to an integer. 5. Then you perform several analog data conversions on it.

I would suggest your results would be a lot like Forrest Gump's box of chocolates. It probably wouldn't take more than a few minutes to fix those issues. The rest of the sketch looks pretty good to me.

Can you describe your wiring. It's too much trouble to look up the datasheet and try to figure out whether you have things connected properly.

I'm using an LM335 with no trouble to control my fridge so you must have something wired incorrectly.

@Honduras, I think the OP's code is OK. He is creating a global variable with a value of 0 and using that to identify which analog pin to read.