//TMP36 Pin Variables int sensor1 = 0; int sensor2 = 2; //the analog pin the TMP36's Vout (sense) pin is connected to //the resolution is 10 mV / degree centigrade with a //500 mV offset to allow for negative temperatures void setup() { Serial.begin(9600); //Start the serial connection with the computer //to view the result open the serial monitor //Set the pins to read pinMode(A2,INPUT); pinMode(A0,INPUT); pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); pinMode(6,OUTPUT); pinMode(7,OUTPUT); pinMode(8,OUTPUT); pinMode(9,OUTPUT); pinMode(10,OUTPUT); pinMode(11,OUTPUT); pinMode(12,OUTPUT); pinMode(13,OUTPUT); } void loop() { //reading from the temperature sensor int outside = analogRead(sensor1); int inside = analogRead(sensor2); // converting that reading to voltage, for 3.3v arduino use 3.3 float voltageOut = outside * 2.16; // 3.3; voltageOut /= 1024.0; float voltageIn = inside * 2.16; voltageIn /= 1024.0; Serial.print(voltageOut); Serial.println(" volts"); Serial.print(voltageIn); Serial.println(" volts"); //this is the outside temp. float temperatureC = ((voltageOut - 0.5) * 100); float temperatureF = ((temperatureC * 9.0 / 5.0) + 32.0); Serial.print("Outside temp is ");Serial.print(temperatureF); Serial.println(" degrees F"); float temperatureInsideC = (voltageIn - 0.5) * 100 ; float temperatureInsideF = ((temperatureInsideC * 9.0 / 5.0); //4 + 25; Serial.print("Inside temp is ");Serial.print(temperatureInsideF); Serial.println(" degrees F"); int ITemp = int(temperatureInsideF); String BTemp = String(ITemp, BIN); while (BTemp.length() < 7) { BTemp = "0" + BTemp; } int z = 0; for(int i = 13 ; i < 7; i--) { if(BTemp.charAt(z) == 1) //(bitRead(tempIn,(14-i)) == 1) { digitalWrite(i ,HIGH); z++; } else { digitalWrite(i, LOW); z++; } } int OTemp = int(temperatureF); //OUTSIDE String BTemp2 = String(OTemp, BIN); while (BTemp2.length() < 7) { BTemp2 = "0" + BTemp; } int q = 0; //int myPins[] = {13,12,11,10,9,8}; Serial.print(BTemp2);Serial.println("<<<<<<< OUTSIDE"); for(int j= 7 ; j < 1; j--) { if(BTemp2.charAt(q) == 1) //(bitRead(tempIn,(14-i)) == 1) { digitalWrite(j ,HIGH); q++; } else { digitalWrite(j, LOW); q++; } } delay(2000); }