loading

// All Rights reserved :) Kiduino

const int sensorPin = A0; const float baselineTemp = 28.0;

void setup() { Serial.begin(9600); for (int pinNumber = 2; pinNumber < 12; pinNumber++) { pinMode(pinNumber, OUTPUT); digitalWrite(pinNumber, LOW); } }

void loop() { int sensorVal = analogRead(sensorPin);

Serial.print("sensor Value: "); Serial.print(sensorVal); // convert the ADC reading to voltage float voltage = (sensorVal / 1024.0) * 5.0;

Serial.print(", Volts: "); Serial.print(voltage); Serial.print(", degrees C: "); float temperature = (voltage - .5) * 100; Serial.println(temperature);

if (temperature < baselineTemp + 0.5) { digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(5, LOW); digitalWrite(8, LOW); digitalWrite(12, LOW); } else if (temperature >= baselineTemp + 0.5 && temperature < baselineTemp + 1) { digitalWrite(2, HIGH); digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, LOW); digitalWrite(8, LOW); digitalWrite(12, LOW); } else if (temperature >= baselineTemp + 1 && temperature < baselineTemp + 1.5) { digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(5, LOW); digitalWrite(8, LOW); digitalWrite(12, LOW); } else if (temperature >= baselineTemp + 1.5 && temperature < baselineTemp + 2) { digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(5, HIGH); digitalWrite(8, LOW); digitalWrite(12, LOW); } else if (temperature >= baselineTemp + 2 && temperature < baselineTemp + 2.25) { digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(5, HIGH); digitalWrite(8, LOW); digitalWrite(12, LOW); } else if (temperature >= baselineTemp + 2.25 && temperature < baselineTemp + 2.50) { digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(5, HIGH); digitalWrite(8, HIGH); digitalWrite(12, LOW); } else if (temperature >= baselineTemp + 2.50 && temperature < baselineTemp + 2.80) { digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(5, HIGH); digitalWrite(8, HIGH); digitalWrite(12, HIGH); } delay(1); }

Step 1: Instructions

For the instructions watch the video :)

<p>Interesting project. You can actually embed youtube videos in you instructable using the embed video tool when editing a step.</p>
<p>Thanks, im all new to this!</p>

About This Instructable

599views

12favorites

License:

Bio: I LOVE ELECTRONICS AND ROCKETS!
More by officialKiduino:Control a LCD with Arduino Arduino Temperature Sensor Code 
Add instructable to: