void setup() {
// put your setup code here, to run once:
pinMode(8, OUTPUT);
}
int blink;
int tempCheck(){
const int BETA=3950;
int analogValue=analogRead(1);
float a=1/(log(1/(1023./analogValue-1)) / BETA+1.0/298.15) - 273.15;
if(a<=20){
blink=2;
}
else if(a>20&&a<30){
blink=4;
}
else{
blink=6;
}
return blink;
}
void blinkLed(int cycles,int del){
for(int i=0;i<cycles;i++){
digitalWrite(8, HIGH);
delay(del);
digitalWrite(8, LOW);
delay(del);
}
}
void loop() {
// put your main code here, to run repeatedly:
blinkLed(tempCheck(),200);
delay(2000);
}