Hi everyone,
I'm new to the Arduino board. I am currently experimenting with it. I am having trouble with a small program that I wrote, hope you guys can help. The purpose of this program is to make 4 LEDs blinking fast in a circle pattern for 10 rounds. Then slow it down. Repeat. However, when it slows down it doesn't go back to blinking fast again. It just keep slowing down until it comes to a complete stop.
int pin12 = 12;
int pin11 = 11;
int pin10 = 10;
int pin9 = 9;
int timer = 100;
int count = 0;
int maxcount = 10;
int countdown = 0;
void setup(){
pinMode(pin12, OUTPUT);
pinMode(pin11, OUTPUT);
pinMode(pin10, OUTPUT);
pinMode(pin9, OUTPUT);
}
void loop() {
if (count < maxcount)
{
count = count + 1;
}
else
{
count = 0;
if (countdown = 0) {
countdown = 1;
}
else {countdown = 0;}
}
if (countdown = 1)
{timer = timer + 25;
}
else {timer = timer - 100;}
digitalWrite(pin9, HIGH);
delay(timer);
digitalWrite(pin9, LOW);
delay(timer);
digitalWrite(pin10, HIGH);
delay(timer);
digitalWrite(pin10, LOW);
delay(timer);
digitalWrite(pin12, HIGH);
delay(timer);
digitalWrite(pin12, LOW);
delay(timer);
digitalWrite(pin11, HIGH);
delay(timer);
digitalWrite(pin11, LOW);
delay(timer);
}