code is working with pin 13 only

**Hi friends this code is working with pin 13 only if I change output pin to 12 or 11 not working led lighting continuously, pls help me out..... Thnx. **

#define key1 2
#define key2 3
#define key3 4
#define key4 5
#define key5 6
#define key6 7
#define key7 8

const int ledPin = 13;

void setup() {

pinMode(key1, INPUT_PULLUP);
pinMode(key2, INPUT_PULLUP);
pinMode(key3, INPUT_PULLUP);
pinMode(key4, INPUT_PULLUP);
pinMode(key5, INPUT_PULLUP);
pinMode(key6, INPUT_PULLUP);
pinMode(key7, INPUT_PULLUP);

pinMode(ledPin, OUTPUT);
}

void loop() {
int key1S = digitalRead(key1);
int key2S = digitalRead(key2);
int key3S = digitalRead(key3);
int key4S = digitalRead(key4);
int key5S = digitalRead(key5);
int key6S = digitalRead(key6);
int key7S = digitalRead(key7);

if(!key1S)
{
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);

}
if(!key2S)
{
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}
if(!key3S)
{
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);

}
if(!key4S)
{
digitalWrite(ledPin, HIGH);
delay(1500);
digitalWrite(LED_BUILTIN, LOW);
delay(1500);

}
if(!key5S)
{
digitalWrite(ledPin, HIGH);
delay(1500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(1500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);

}
if(!key6S)
{
digitalWrite(ledPin, HIGH);
delay(1500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);

}
if(!key7S)
{
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(1500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(LED_BUILTIN, LOW);
delay(500);
}

delay(100);
}

You only ever write ledPin HIGH

Please remember to use code tags when posting code

explain what does the line

digitalWrite(ledPin, HIGH);

do?

explain what does the line

      digitalWrite(LED_BUILTIN, LOW);

do?

best regards Stefan

Replace all the instances of LED_BUILTIN with ledPin and then you can use any pin.

LED_BUILTIN Is a constant that is fixed by the type of Arduino you have and can not be changed.

Thnx Grumpy_Mike ... After replacing all the instances of LED_BUILTIN with ledPin ....It's working fine...Thank alot for helping me.

ranjan131:
Thnx Grumpy_Mike … After replacing all the instances of LED_BUILTIN with ledPin …It’s working fine…Thank alot for helping me.

Do you understand what the problem was ?