Not work delay()

hi i have an Arduino uno
i have put a led in gnd and digital 13
i have write the code but not work delay(1000)
why?

int pin = 13;

void setup() {
pinMode (pin,OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
digitalWrite(pin,HIGH);
delay(1000);
digitalWrite(pin,LOW);
  
}

No, the delay works fine. You need to understand your code better. You are setting the pin HIGH, then delaying 1s, then setting it LOW and immediately HIGH again (for only a few microseconds is the pin ever LOW).

Perhaps you meant:

void loop ()
{
  digitalWrite(pin,HIGH);
  delay(1000);
  digitalWrite(pin,LOW);
  delay(1000);
}

need delay(1000); after digitalWrite(pin,LOW); - the LED is only off for a few microseconds. :grin:

You missed the delay in the code...
The code which you wrote will result in the LED constantly glowing...

So just add delay (1000);
after digitalWrite(pin,LOW);

which will tell the arduino for how long does it have to keep the LED off...

have put a led in gnd and digital 13

And you did remember a resistor, didn't you?

AWOL:

have put a led in gnd and digital 13

And you did remember a resistor, didn't you?

:stuck_out_tongue:
and if that tiny valuable thing is not been used... :frowning:
the LED has gone bad... :stuck_out_tongue:

and if that tiny valuable thing is not been used... smiley-sad
the LED has gone bad...

The current limiting resistor is not there to protect the LED. It's the more valuable thing on the other end that it is there to protect.

Completely unnecessary any way, the uno has an onboard LED on pin 13. Probably following a tutororial for a dawn-of-time arduino which had a resistor built in for pin 13 but no LED.