You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
int pin = 0; // analog pinint tempCelsius = 0, tempFahrenheit=0; // temperature variablesint samples[8]; // average of readingsint i;void setup(){ // this is where you'd start Serial communication if you want to use that}void loop(){ for(i = 0;i< =7;i++){ samples[i] = ( 5.0 * analogRead(pin) * 100.0) / 1024.0; tempc = tempc + samples[i]; // add the eight samples together delay(1000); } tempc = tempc/8.0; // this is the average of the eight samples tempf = (tempc * 9)/ 5 + 32; // converts to fahrenheit delay(1000); // delay before loop}