Stap 3: De code
Excuses, ik dacht dat de code was in al op de vorm van tekst.
float temp;
int tempPin = 0;
int pin2 = 2;
int pin3 = 3;
int pin4 = 4;
int pin5 = 5;
int pin7 = 7;
int pin8 = 8;
int pin9 = 9;
int pin10 = 10;
VOID Setup
{
pinMode (pin2, OUTPUT);
pinMode (pin3, OUTPUT);
pinMode (pin4, OUTPUT);
pinMode (pin5, OUTPUT);
pinMode (pin7, OUTPUT);
pinMode (pin8, OUTPUT);
pinMode (pin9, OUTPUT);
pinMode (pin10, OUTPUT);
Serial.begin(9600);
}
void loop
{
Temp = analogRead(tempPin);
Temp = (5.0 * temp * 100.0)/1024.0;
Serial.Print(temp);
Serial.println();
Als (temp > = 16.00){digitalWrite(pin10,HIGH);}
Als (temp > = 17.00){digitalWrite(pin9,HIGH);}
Als (temp > = 18.00){digitalWrite(pin8,HIGH);}
Als (temp > = 19.00){digitalWrite(pin7,HIGH);}
Als (temp > = 20.00){digitalWrite(pin5,HIGH);}
Als (temp > = 21.00){digitalWrite(pin4,HIGH);}
Als (temp > = 22.00){digitalWrite(pin3,HIGH);}
Als (temp > = 23.00){digitalWrite(pin2,HIGH);}
delay(99);
digitalWrite(pin10,LOW);
digitalWrite(pin9,LOW);
digitalWrite(pin8,LOW);
digitalWrite(pin7,LOW);
digitalWrite(pin5,LOW);
digitalWrite(pin4,LOW);
digitalWrite(pin3,LOW);
digitalWrite(pin2,LOW);
delay(1);
}