Hello world,
i would like to make a mash heater wich is guided by an arduino (uno).
my qeustion is about the bool varriable:
in the following code, i wanted to increase the temperature, till it reaches a certain pont. From there on i would like to keep the temperature above said pont.
void TempRegelung(){
if(Tempanstieg = true){
if(TempZustand > 480){ //480= arbitrayry point picked from my thermoresistor
digitalWrite(LedPin,HIGH); //my thermorestor sits at ~500 at room temp
}else { //the value of it decreases if it gets warmer
digitalWrite(LedPin,LOW);
Tempanstieg = false;
delay(500); //added to see if the loop moves on or got stuck here
}
}
if(Tempanstieg = false){
if(Temphalten = true){
if(TempZustand > 470){
digitalWrite(LedPin,HIGH);
}else{
digitalWrite(LedPin,LOW);
}
}
}
There fore i thought i make a system with two bool variable. When the set temperature is reached, the first bool turns to = false and so the loop should move on to the next if() function where the next bool var. is included. But the function does not move on.
the complete code:
const byte LedPin = 4;
const byte TempPin = A5;
int TempZustand; //a varable for the temperatur
bool Temphalten = true;
bool Tempanstieg = true;
void setup() {
Serial.begin(9600);
pinMode(LedPin,OUTPUT);
pinMode(TempPin,INPUT);
}
void loop() {
TempRead();
TempRegelung();
}
void TempRegelung(){
if(Tempanstieg = true){
if(TempZustand > 480){ //480= arbitrayry point picked from my thermoresistor
digitalWrite(LedPin,HIGH); //my thermorestor sits at ~500 at room temp
}else { //the value of it decreases if it gets warmer
digitalWrite(LedPin,LOW);
Tempanstieg = false;
delay(500); //added to see if the loop moves on or got stuck here
}
}
if(Tempanstieg = false){
if(Temphalten = true){
if(TempZustand > 470){
digitalWrite(LedPin,HIGH);
}else{
digitalWrite(LedPin,LOW);
}
}
}
}
void TempRead(){ //a function to see the temp. on the serial monitor
TempZustand = analogRead(TempPin);
Serial.print("TempFühler: ");
Serial.println(TempZustand);
}
edit: i simply forgott in the if functions the second "=".
sorry to bother