On-board LED not flashing in sync with LED on breadboard

I have an extremely newbie question…

I’m just trying to make an LED blink using the following code:

const int ledPin = 13; // LED connected to digital pin 13

void setup()
{
pinMode(ledPin, OUTPUT);
}

/* Blinks an SOS signal */
void loop()
{
digitalWrite(ledPin, HIGH);
delay(500);
digitalWrite(ledPin, LOW);
delay(500);
}

I was expecting the LED on the breadboard to flash exactly in sync with the LED on the Arduino, but it flashes opposite to what I expected. See the attached movie for the behavior.

Any advice would be greatly appreciated

IMG_0155.MOV (288 KB)

It looks like you have a black wire connected to pin 13 and the GND bus on the breadboard and you have a red wire, presumably 5V to the VCC bus. So, when pin 13 goes high, you are feeding 5V on BOTH VCC and the GND bus, causing the breadboard LED to turn off. When the pin goes LOW, it acts as a GND and the LED turns on.

When you set the pin HIGH, you are SOURCING voltage. When it goes LOW, it sinks.

Got it, thank you! Works now that I'm using the correct ground pin, which is the one next to pin 13.