/* 2CH Temperature Measure Connection CH1 5V-(Thermistor 103AT-11)-A0-470 OHM-GND CH2 5V-(Thermistor 103AT-11)-A6-470 OHM-GND */ int sensorPin1 = A0; // select the input pin for the potentiometer int sensorPin2 = A6; // select the input pin for the potentiometer int ledPin = 13; // select the pin for the LED double sensorValue1 = 0; // variable to store the value coming from the sensor double sensorValue2 = 0; // variable to store the value coming from the sensor long iMax=10000; double Temp1=0; double Temp2=0; long RepetitinTime=20000; //Every 20000 msec=20 sec void setup() { // declare the ledPin as an OUTPUT: pinMode(ledPin, OUTPUT); analogReference(DEFAULT); Serial.begin(9600); } void loop() { sensorValue1=0; sensorValue2=0; iMax=0; while( (millis()%RepetitinTime)<(RepetitinTime-10)){ iMax=iMax+1; sensorValue1 = sensorValue1+ analogRead(sensorPin1); sensorValue2 = sensorValue2+ analogRead(sensorPin2); } delay(10); Temp1=1/(0.003356+0.0002911*log((48.0810*iMax/sensorValue1)-0.0470))-273.15;//Temp1 measure Temp2=1/(0.003356+0.0002911*log((48.0810*iMax/sensorValue2)-0.0470))-273.15;//Temp2 measure Serial.print(millis()/1000); Serial.print(" sec / "); Serial.print(Temp1); Serial.print(" C/ "); Serial.print(Temp2); Serial.println(" C"); }