bad code? it's just a couple lines.

I have a 500ohm (a little high but should not matter) resistor in line from pin 12 to an LED. Why won't the LED light? My code?

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

  pinMode(12,OUTPUT);
  digitalWrite(12, HIGH);
  delay(1000);
  digitalWrite(12, LOW);
  delay(1000);
}

void loop() {
  // put your main code here, to run repeatedly:

}

Is the LED polarity correct?
Do you have a connection between the LED anode and the Arduino GND?
What Arduino board are you using?

Check your polarity. Should be to simple not to work.

Played around with polarity (all the kids do these days). Took out the resistor, worked. Put resistor in, nothing. Resistor read correctly on meter. Put it back in and it still would not let the LED come on. Weird.

You're getting around 6mA in that circuit. Is that enough for the LED?

(5v - 1.7v) / 500 = 0.0066

Or maybe you're using a 3.3V Arduino in which case you're only getting 3mA. Or maybe it's a blue LED in which you're getting almost no current.

Steve

AM I missing something here?
Your code is just in the setup?
not in the loop?

You are turning the output pin on for one second and then off forever. Try this:

void setup() {
  // put your setup code here, to run once:
  pinMode(12,OUTPUT);
}

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

Or better yet, use the built-in LED on Pin 13:

void setup() {
  // put your setup code here, to run once:
  pinMode(LED_BUILTIN,OUTPUT);
}

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