-3
int ledPin1 = 1;
int ledpin2 = 2;
int ledpin3 = 3;
int ledpin4 = 4;
int ledpin5 = 5;
int ledpin6 = 6;

void setup()
{
  //initialize pins as outputs
  pinMode(ledPin1, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  pinMode(ledPin3, OUTPUT);
  pinMode(ledPin4, OUTPUT);
  pinMode(ledPin5, OUTPUT);
  pinMode(ledpin6, OUTPUT);
}

void loop()
{
  digitalWrite(ledPin1, HIGH);
  delay(200);
  digitalWrite(ledPin2, HIGH);
  delay(200);
  digitalWrite(ledPin3, HIGH);
  delay(200);
  digitalWrite(ledPin4, HIGH);
  delay(200);
  digitalWrite(ledPin5, HIGH);
  delay(200);
  digitalWrite(ledpin5, LOW);
  digitalWrite(ledpin4, LOW);
  digitalWrite(ledpin3, LOW);
  digitalWrite(ledpin2, LOW);
  digitalWrite(ledpin1, LOW);
  digitalWrite(ledPin5, HIGH);
  delay(200);
  digitalWrite(ledPin4, HIGH);
  delay(200);
  digitalWrite(ledPin3, HIGH);
  delay(200);
  digitalWrite(ledPin2, HIGH);
  delay(200);
  digitalWrite(ledPin1, HIGH);
  delay(200);
} 

closed as off-topic by gre_gor, user31481, dda, Avamander, MatsK Dec 16 '17 at 15:42

  • This question does not appear to be about Arduino, within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    I'm voting to close this question as off-topic because it's just a typo. – gre_gor Dec 12 '17 at 18:51
4

You mix capitals with non capital characters.

The case of characters in variable names are important, so ledPin2 is a different variable than ledpin2.

Also, never mix similar names (unless it is trivial). Either always use ledpinx or ledPinx, not sometimes the first and sometimes the second version.

camelCasing is normally used for local variables, means the first sub-word starts with a lower case, rest with upper case, thus led-pin will become ledPin.

Pascal case is the other way: that would become LedPin in your case.

For global variables I tend to use PascalCasing, or if it is within one file, prefixed camelCasing with an underscore.

1

I have corrected your code it was just because you mixed capital and lowercase letters while declaring ledPin. Keep it same everywhere in setup() and loop().

int ledPin1 = 1;
int ledPin2 = 2;
int ledPin3 = 3;
int ledPin4 = 4;
int ledPin5 = 5;
int ledPin6 = 6;

void setup()
{
    //initialize pins as outputs
    pinMode(ledPin1, OUTPUT);
    pinMode(ledPin2, OUTPUT);
    pinMode(ledPin3, OUTPUT);
    pinMode(ledPin4, OUTPUT);
    pinMode(ledPin5, OUTPUT);
    pinMode(ledPin6, OUTPUT);
}

void loop()
{
    digitalWrite(ledPin1, HIGH);
    delay(200);
    digitalWrite(ledPin2, HIGH);
    delay(200);
    digitalWrite(ledPin3, HIGH);
    delay(200);
    digitalWrite(ledPin4, HIGH);
    delay(200);
    digitalWrite(ledPin5, HIGH);
    delay(200);
    digitalWrite(ledPin5, LOW);
    digitalWrite(ledPin4, LOW);
    digitalWrite(ledPin3, LOW);
    digitalWrite(ledPin2, LOW);
    digitalWrite(ledPin1, LOW);
    digitalWrite(ledPin5, HIGH);
    delay(200);
    digitalWrite(ledPin4, HIGH);
    delay(200);
    digitalWrite(ledPin3, HIGH);
    delay(200);
    digitalWrite(ledPin2, HIGH);
    delay(200);
    digitalWrite(ledPin1, HIGH);
    delay(200);
}

Not the answer you're looking for? Browse other questions tagged or ask your own question.