no just runs one way and when button go's high then go's the other way
but thinking about it, the code is runing over and over so it will keep doing it?
so to shop this i have to do somthing like this?
int ledPin = 13; // LED connected to digital pin 13
int button = 2; // button pin
int count = 0; // Our blink counter
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
pinMode(button, INPUT);
}
// the loop() method runs over and over again,
// as long as the Arduino has power
void loop()
{
if (digitalRead(button)== HIGH) // buttin when high
{
if (count < 1) {
digitalWrite(ledPin, HIGH); // set the LED on
delay(1000); // wait for a second
digitalWrite(ledPin, LOW); // set the LED off
delay(1000); // wait for a second
count++; // add one (1) to our count
}
}
else {
if(count == 1) count =0; // resetting the count
}
}