Hi,
I am totally new to Arduino. I'm writing a code that involves 5 LEDs. The way I want it to work is:
Step 1: Light middle LED only
Step 2: Light first and last only
Step 3: Light first, last, and middle only
Step 4: Light first two and light last two only
With a delay between all of the steps(which I set to 'delay(100);'). When I run the code it stops at Step 2: Light first and last only.
Here's the code. Please ignore the integer names and arbitrary pin assignments.
const int mino1 = 5 ; // LED connected to digital pin 5
const int mino3 = 7 ; // LED connected to digital pin 7
const int mino5 = 9 ; // LED connected to digital pin 9
const int mino7 = 11 ; // LED connected to digital pin 11
const int mino9 = 13 ; // LED connected to digital pin 13
void setup() {
pinMode(mino1, OUTPUT);
pinMode(mino3, OUTPUT);
pinMode(mino5, OUTPUT);
pinMode(mino7, OUTPUT);
pinMode(mino9, OUTPUT);
}
void loop()
{
digitalWrite(mino5, HIGH);
delay(100);
digitalWrite(mino5, LOW);
digitalWrite(mino1, HIGH);
digitalWrite(mino9, HIGH);
delay(100);
digitalWrite(mino5, HIGH);
delay(100);
digitalWrite(mino5, LOW);
digitalWrite(mino7, HIGH);
digitalWrite(mino3, HIGH);
delay(5000);
}
Thank you in advance.