Hi, @janosch1
Connect the green led wire back to pin 3 and try this code;
int switchPin = 2;
int greenledPin = 3;
bool switchstate;
void setup()
{
pinMode(switchPin, INPUT);
pinMode(greenledPin, OUTPUT);
}
void loop()
{
if (switchstate == LOW)
{
digitalWrite(greenledPin, LOW);
}
else
{
digitalWrite(greenledPin, HIGH);
}
}
Tell us what happens when you press the button.
The above instructions will show you how to post your code in a scrolling window to make it easy to read.
Thanks.. Tom..