Pins 2-5 not working - MEGA 2560

Just learning here, and messing with some leds.
I have pins 2-13 connected to leds. I'm using a sequence to blink them on/off 6,7,8,etc to 13.
It works ok, blinking them up and down the line.
Relevant code:

int timer = 400; // The higher the number, the slower the timing.
int ledPins[] = {
6, 7, 8, 9, 10, 11, 12, 13 }; // an array of pin numbers to which LEDs are attached
int pinCount = 8; // the number of pins (i.e. the length of the array)

My problem is leds 2-5. If I add pins 2-5 to the ledpins statement, and increase pinCount to 12, leds 2-5 don't turn on. I'm hoping those pins aren't burned out. There hasn't been any shorts.

Any help appreciated.

You use resistors with those leds ?

Pin 2-5 are normal digital pins, they should work like any other pins.

This is the pinmapping : https://www.arduino.cc/en/Hacking/PinMapping2560
It shows that pin 2-5 are PORT E. But so are pin 0 and 1, and those are used to upload a sketch.

Is there something special you do with one of those pins in software or hardware ?

I'm using 220 ohm resistors on all the pins/leds. Not doing anything special with any of them. Just want them all to blink on/off.
I'm not using 0 or 1. Uploading via USB.

Can you post all your code please.

The pins could be damaged inside the chip, but it doesn't make sense. Is it a cheap clone board with missing connections to those pins ? Did they work before ?

This is the kit I purchased.

This is the code I'm using for 8 LEDs


*/

int timer = 400; // The higher the number, the slower the timing.
int ledPins[] = {
6, 7, 8, 9, 10, 11, 12, 13 }; // an array of pin numbers to which LEDs are attached
int pinCount = 8; // the number of pins (i.e. the length of the array)

void setup() {
// the array elements are numbered from 0 to (pinCount - 1).
// use a for loop to initialize each pin as an output:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
pinMode(ledPins[thisPin], OUTPUT);
}
}

void loop() {
// loop from the lowest pin to the highest:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
// turn the pin on:
digitalWrite(ledPins[thisPin], HIGH);
delay(timer);
// turn the pin off:
digitalWrite(ledPins[thisPin], LOW);

}

// loop from the highest pin to the lowest:
for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) {
// turn the pin on:
digitalWrite(ledPins[thisPin], HIGH);
delay(timer);
// turn the pin off:
digitalWrite(ledPins[thisPin], LOW);
}
}

This the code I'm trying to use for 12 LEDs


*/

int timer = 400; // The higher the number, the slower the timing.
int ledPins[] = {
2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 }; // an array of pin numbers to which LEDs are attached
int pinCount = 12; // the number of pins (i.e. the length of the array)

void setup() {
// the array elements are numbered from 0 to (pinCount - 1).
// use a for loop to initialize each pin as an output:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
pinMode(ledPins[thisPin], OUTPUT);
}
}

void loop() {
// loop from the lowest pin to the highest:
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
// turn the pin on:
digitalWrite(ledPins[thisPin], HIGH);
delay(timer);
// turn the pin off:
digitalWrite(ledPins[thisPin], LOW);

}

// loop from the highest pin to the lowest:
for (int thisPin = pinCount - 1; thisPin >= 0; thisPin--) {
// turn the pin on:
digitalWrite(ledPins[thisPin], HIGH);
delay(timer);
// turn the pin off:
digitalWrite(ledPins[thisPin], LOW);
}
}

The only thing that is changed is the pinCount and number of outputs.

Please read this:-
How to use this forum
Because your posting of code is breaking the rules.

This is the kit I purchased.
http://i.ebayimg.com/00/s/MTA2N1gxNjAw/z/nQwAAOSwjVVVhfLr/$_57.JPG

Looks like it is not a genuine Arduino.

Grumpy_Mike:
Please read this:-
How to use this forum
Because your posting of code is breaking the rules.

WTHeck. You told me to. If you want file attachments, then say so.

Is it mandatory to own Genuine Arduinos? After all, everything is open source.

If you want file attachments, then say so.

OK let me spell it out
U S E C O D E T A G S

Or are you just too lazy to read?

Is it mandatory to own Genuine Arduinos?

Who do you think pays for this forum?

But no plenty of people don't have them. However, there are clones and ripoffs. Does yours say Arduino on it. If not it is fine, if so then it is guilty of "passing off".
The point is that cheap rip offs can often be of a low quality and that is what it looks like you have.

AxlMyk:
WTHeck. You told me to. If you want file attachments, then say so.

No, we absolutely do not want you to use file attachments as the forum managers have seen fit to seriously break the system for using file attachments and are not responsive to complaints.

What we do want you to do, is to read the instructions and post your code in a manner that makes it readily usable. At this point, you should go back to where you posted the code, choose "modify" to that posting and mark up the code appropriately.

AxlMyk:
Is it mandatory to own Genuine Arduinos? After all, everything is open source.

No, not mandatory.

The point made is that a "genuine" Arduino from a reputable seller comes with a much stronger warranty of fitness for purpose, whereas a proportion of "non-genuine" parts may be faulty. The phenomenon of fakes in this day and age, is not limited to Rolex watches and Oroton handbags.

AxlMyk:
This is the kit I purchased.

That's a very impressive kit.

All things considered, it would benefit from containing more than one Arduino processor board, and perhaps extra jumper wires as you are likely to want to have more than one project set up at any one time. I know I do. :grinning:

So we trust you have performed basic checking procedures, making sure the extra four LEDs actually work and are connected the correct way round by exchanging them with the ones in the positions that are working at present?

The sketch is okay. A resistor plus led is okay. Now everything is pointing towards your Mega board.

Does it have brand ? or is there some kind of identification on it ?

Can you follow the traces from pin 2-5 towards the chip ? Check the soldering of the chip with a magnifier.
Can you measure if they are connected somehow to something ? For that I use a multimeter diode test from those pins to 5V and GND when the Arduino board is not powered on.

What did you pay for the kit ? 100 dollars ? Perhaps more, it is a big kit.

we absolutely do not want you to use file attachments

Really? I use them all the time without issue. I'd prefer folks use them vs file hosting sites that I often cannot access (blocked at work).
Attaching larger than 9500 byte code is not going to be a problem.
Attaching 8 Megapixel pictures could be, and are blocked:

"Allowed file types: doc, gif, jpg, mpg, pdf, png, txt, zip, c, h, cpp, ino, pde
Restrictions: maximum total size 1 MB, maximum individual size 1 MB"

I tried a large file and got this message box:
"There was a problem during the uploading of 20131116_151020.jpg. [a >3MB jpg I had attached]
Your post has been made, however the above attachment was not attached. Please use the Back button to edit your post and submit any required changes.Your file is too large. The maximum attachment size allowed is 1280 KB."
So attach away - if it's too big, you'll be told.

CrossRoads:
Really? I use them all the time without issue. I'd prefer folks use them vs file hosting sites that I often cannot access (blocked at work).

Yes, really.

Bully for you. I on the other hand, have a similar problem with attachments not being accessible or usable due to the obtuseness of the forum configuration which we have previously discussed, which is an exact mirror of your "issue". And it is clearly vastly preferable for images and code to appear within the text of a posting.

Perhaps it would be more useful if you were to specify which crap hosting sites are - quite understandably to be sure; I have no dispute in that regard - blocked by your "work" firewall, and simply explain to people which are the proper ones to use.

There are too many sites that are blocked. I can't even see stock charts at fidelity.com. big corporate security, I don't respond to sites that come up with blocked pictures anymore.

I don't need this crap. I'll go somewhere else.
And to think I was actually going to buy 10 "genuine" Arduino kits as gifts for grandkids.

Well, if you happen to be still here ...

Did you follow my advice in reply #10?

I feel sorry for the grandkids :frowning: