#define ntc A0
void setup() {
Serial.begin(9600);
pinMode(ntc, OUTPUT);
for(int aa=4;aa<=13;aa++){
pinMode(aa, OUTPUT);
}
}
void loop() {
const float BETA = 3950; // should match the Beta Coefficient of the thermistor
int analogValue = analogRead(A0);
float celsius = 1 / (log(1 / (1023. / analogValue - 1)) / BETA + 1.0 / 298.15) - 273.15;
Serial.println(celsius);
if(celsius>=70.00){led(10);}
else if(celsius>=60.00){led(9);}
else if(celsius>=50.00){led(8);}
else if(celsius>=40.00){led(7);}
else if(celsius>=30.00){led(6);}
else if(celsius>=20.00){led(5);}
else if(celsius>=10.00){led(4);}
else if(celsius>=0.00){led(3);}
else if(celsius>=-10.00){led(2);}
else if(celsius>=-20.00){led(1);}
else {led(0);}
delay(1000);
}
void led(int aa){
int pin = aa+3;
for(int bb=13;bb>=4;bb--){
digitalWrite(bb, LOW);
}
for(int bb=pin;bb>=4;bb--){
digitalWrite(bb, HIGH);
}
}