Someone could give us our own program

int MOTOR=1;
int VENTILATOR=2;
int WINDRAD=3;
int taster=4;
int LEDblau=5;
int LEDrot=6;
int tasterstatus=0;
int LEDwei=7;
int LEDgelb=8;
int LEDgruen=9;
int TMP36 = A0; // Der Temperatursensor wird an Pin A0 angeschlossen.
int sensorwert;
int temperatur =0; // Unter der Variablen "temperatur" wird später der Temperaturwert.
int t=500; // Der Wert "t" gibt im Code die zeitlichen Abstände zwischen den einzelnen Messungen vor.
int x=0;

void setup()
{
Serial.begin(9600); // Im Setup beginnt die serielle Kommunikation damit die Temperatur an den seriellen Monitor übertragen wird.
pinMode(MOTOR,INPUT);
pinMode(VENTILATOR,INPUT);
pinMode(WINDRAD,OUTPUT);
pinMode(taster,OUTPUT);
pinMode(LEDblau,OUTPUT);
pinMode(LEDrot,OUTPUT);
pinMode(LEDwei,OUTPUT);
pinMode(LEDgelb, OUTPUT);
pinMode(LEDgruen, OUTPUT);

}

void loop()
{

tasterstatus=digitalRead(taster);

while(tasterstatus == LOW);
{
digitalWrite(LEDblau, LOW);
digitalWrite(LEDrot, LOW);
digitalWrite(LEDgruen, LOW);
digitalWrite(LEDwei, LOW);
digitalWrite(LEDgelb, LOW);
}
if (tasterstatus == HIGH)
{
digitalWrite(LEDblau, HIGH);
digitalWrite(LEDrot, HIGH);
digitalWrite(VENTILATOR, HIGH);
delay(1000);
digitalWrite(LEDblau, LOW);
digitalWrite(LEDrot,LOW);
digitalWrite(VENTILATOR,LOW);
sensorwert=analogRead(TMP36); //Auslesen des Sensorwertes.
temperatur= map(sensorwert, 0, 410, -50, 150); //Umwandeln des Sensorwertes mit Hilfe des "map" Befehls.
delay(t);
Serial.print(temperatur);
Serial.println(" Grad Celsius");
}
if (tasterstatus == HIGH)
{
x=x+1;
}
if (x=3)
{
digitalWrite(LEDgruen, HIGH);
delay(2000);
digitalWrite(LEDgruen, LOW);
x=0;
}

}

Is that semicolon supposed to be there?

I suspect not

After that, the problem becomes "how does ,,the value ever change?"

Please remember to use code tags when posting code

ok all right, we'll revise it

This is unusual:

. . .
pinMode(taster,OUTPUT);
. . .
tasterstatus=digitalRead(taster);
. . .

sorry I made a mistake

Hello, do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation for your ask).

Were you trying to compare 'x' to '3'? Use '==' instead of '='. What you have is equivalent to:

  x = 3;
  if (x != 0) // Always true since x == 3.

@arduino_king123, although solved, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project :wink: See About the Installation & Troubleshooting category.

Someone could give us our own program

this headline holds the world-record in beeing offtopic and confusing

1 Like