I am new to arduino.

We have an assignment creating our first code, and my Instructor gave my code a comment "Your code only executes the zero state once on initialization." and we wants me to modify. this is my code:

int ledPin1 = 11;
int ledPin2 = 12;
int ledPin3 = 13;

void setup() {
// put your setup code here, to run once:

pinMode(ledPin1,OUTPUT);
pinMode(ledPin2,OUTPUT);
pinMode(ledPin3,OUTPUT);
}

void loop() {
// put your main code here, to run repeatedly:
digitalWrite(ledPin1,HIGH);
digitalWrite(ledPin2,LOW);
digitalWrite(ledPin3,LOW);
delay(500);

digitalWrite(ledPin1,LOW);
digitalWrite(ledPin2,HIGH);
digitalWrite(ledPin3,LOW);
delay(500);

digitalWrite(ledPin1,HIGH);
digitalWrite(ledPin2,HIGH);
digitalWrite(ledPin3,LOW);
delay(500);

digitalWrite(ledPin1,LOW);
digitalWrite(ledPin2,LOW);
digitalWrite(ledPin3,HIGH);
delay(500);

digitalWrite(ledPin1,HIGH);
digitalWrite(ledPin2,LOW);
digitalWrite(ledPin3,HIGH);
delay(500);

digitalWrite(ledPin1,LOW);
digitalWrite(ledPin2,HIGH);
digitalWrite(ledPin3,HIGH);
delay(500);

digitalWrite(ledPin1,HIGH);
digitalWrite(ledPin2,HIGH);
digitalWrite(ledPin3,HIGH);
delay(500);
}

What initialization do I need to do? thanks

Use the correct datatypes for the pin numbers?
I have no idea what the comment means.

Maybe the instructor (I use the word in the loosest possible sense) doesn't like the use of delay, and would prefer to see a state-machine.

The “instructor” apparently means that all three LEDs are LOW (the “zero state”) only in setup (and never in the loop).

As written, loop cycles 1->7, 1->7, etc.

The “instructor” seems to want the loop to show 0->7, 0->7, etc.

PS: you would probably get a better score if you figured out a way to get rid of all but one set of those digitalWrites in the loop. Hint: check out the “bits and bytes” functions in the Reference page…you’ll find one to help with that… :wink:

thank for all the answers guys!