O holy simplicity. I've seen lots of solutions for this but none that will fit to my scheme. First of all, lets add simple code:
void setup() {
pinMode(0, OUTPUT);
pinMode(1, INPUT);
}
void loop() {
int a=digitalRead(1);
if(a==LOW) {
delay(1000);
digitalWrite(0, HIGH);
delay(1000);
digitalWrite(0, LOW);
}
}
What the heck I need to add that the IF command runs only once while button is staying in low state and it will be reset eventually when button is set to high again. I've read five different solutions here and tried them out and yet not working as I intented. Rest of the solutions that I found in the net were complicated and I needed to add libraries or alter the code wayyyyyy too much. I'm trying to find the most simple solution for this simple code. And as it will be simple, for some reason I'm over thinking it and not finding solution myself.