Arduino pins not lighting up led

Hello everybody!
I have recently had a really strange problem with my Arduino: It doesn’t want to light up led’s. Now this might just sound like some mistake in my code or something but I really can’t find out what is wrong. I have the led hooked up like on the diagram, but the led doesn’t want to light up from any of the pins. This might sound like a dead led, but If I connect it directly to the 5v and gnd it lights up, and i’m kinda lost at this point. I have this problem on my Arduino mega and Nano, and i’m not really shure what I’ve done wrong :confused:

I have tried:

  • Turning the Led the other way
  • Placing the led in d13
  • different sketches
  • different led’s

(deleted)

As pictured, the LED appears to backwards, you want the flat spot on the body, generally the shorter lead, going to Gnd.

What value resistor? 220 ohm to around 1K?

Ahh, well sorry about that, i'm just using the standard blink code:

void setup() {
  // initialize digital pin 13 as an output.
  pinMode(12, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(12, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);              // wait for a second
  digitalWrite(12, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);              // wait for a second
}

(deleted)

Actually yes, that fixed the problem :o
Thanks my man, I had no idea the solution was so simple!

Thanks for the answers, and sorry for the a little too easy solution :stuck_out_tongue: