4 led chasing issues

Hello,
I'm new to Arduino and enjoying it so far but I've run into what I thought should be a really simple problem which has become a headache.

I'm running a sketch to chase 4 x led's in sequence from an arduino uno using pin outs 4,5,8 & 9. The Led cathodes run out to the common negative rail on my breadboard with a single 330 Ohm resistor.

The sketch I have used has compiled and uploaded but it only runs half the sequence (4&5).

I have checked led's 8&9 and they have not blown. I have also tried this with an arduino Nano and I get the same thing, so I'm reasonably sure it's not the board. I have even changed breadboards but don't know what to try next. Any help greatfully received. Steve

See sketch below:

void setup(){
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
}

void loop(){
digitalWrite(4,HIGH);
delay(1000);
digitalWrite(4,LOW);
delay(100);
digitalWrite(5,HIGH);
delay(1000);
digitalWrite(5,LOW);
delay(100);
digitalWrite(8,HIGH);
delay(1000);
digitalWrite(8,LOW);
delay(100);
digitalWrite(9,HIGH);
delay(1000);
digitalWrite(9,LOW);
delay(100);
}

The Led cathodes run out to the common negative rail on my breadboard with a single 330 Ohm resistor.

NO you can’t wire them like that, each led requires it’s own resistors.

The misswiring is stopping it working.
Also post your code properly using code tags, read the how to use this forum sticky post.

Hi Grumpy_Mike,
Thanks for your response. I’ve tried individual resistor / led connection but I have the same issue.
Thanks for tag tip I will check out forum posting notes again.
Steve

Ok so the next step is to post your schematic and a photograph of your wiring so we can check you have not made any errors.
I can't spot anything in your code that would indicate that what you want to do would not work.

Grumpy_Mike:
NO you can’t wire them like that, each led requires it’s own resistors.

Yes, you can. In general, Mike is correct, but in this particular case, because only one led is on at any instant, you do only need one resistor. If you change the pattern such that more than one led is on at once, then you will need more resistors.

Try some other Arduino pins instead of the ones that don't work. Perhaps you have some damaged pins.

Switch up the LEDs. Make sure you have them going the right way.
Change pins.
Make sure you're actually uploading the code successfully.
Does the loop cycle back to 4 & 5 after the appropriate amount of time, so the only thing that isn't happening is 8 & 9 lighting up?

It's honestly faster if you just did some obvious troubleshooting than waiting for anyone here play a guessing game as to what's actually happening.