//temeratuer sensor using LM 35 sensor. //toggle"limit"switch enable pin"L2" on arduino pin 3 "as power switch" //other two pin one"L1" with Gnd,and the other"COM" To Vcc //Lm 35 have 3 pin , +Vcc,Gnd,out //hooked up: //connect pin one to +5v "from arduino board" //connect pin two to A0 analoge input. //connect pin three to Gnd //LM 35 have a linearity curve // it change 10mV for each 1 Celesus //created by Mohannad Rawshdeh jan 23 2012 int power; float sensor=0; float input=0;//voltage read on pin 2 float celsius=0; float fahrenheit=0; void setup(){ Serial.begin(9600); pinMode(3,INPUT); } void loop(){ power= digitalRead(3); if (power==HIGH){ sensor = analogRead(A0); input = (sensor*5000)/1024; // convert raw sensor value to millivolts celsius = input/10; // convert millivolts to Celsius fahrenheit = ((celsius * 1.8)+32); // convert celsius to fahrenheit Serial.println(" sensor read"); Serial.println(sensor); Serial.println(" --------------------------"); delay(1000); Serial.print("Temperature: "); Serial.print(celsius,2); Serial.println(" degrees C"); Serial.print("Temperature: "); Serial.print(fahrenheit,2); Serial.println(" degrees F"); Serial.println("_ _ _ _ _ _ _ _ _ _ _ _ _ _ "); delay (2000); // wait a second, otherwise the serial monitor box will be too difficult to read } }