Go Down

Topic: First LED Chaser and Curious Problem (Read 908 times) previous topic - next topic

orangeman555

I attempted to make an LED chaser with pins 1-7.

I have them switching with a for-loop, with the counter choosing the pin to light up.

for(count = 0; count<=7; count++){...

You get the idea.

Strangely a few of the pins seem rather weak! They barely light up the LED. So it appears to skip an LED in sequence.

I was wondering what might cause this? I'm still quite new to Arduino.

Grumpy_Mike

Don't use pins 0 & 1 there are fore the serial port.
All the pins you do use must be declaired as outputs in setup using pinMode
Use resistors with each LED.

orangeman555

Thanks. I was a little skeptical about those first two pins.

All the pins share a resister before they go to ground - no two are lit up at the same time.

Thanks!

Grumpy_Mike

Quote
All the pins share a resister before they go to ground

As long as no two are one that is fine. If more then one is on then the brightness will change the more are on.

orangeman555

Not to go off-topic, but where can I find a guide to all the pins of the microcontroller?

Grumpy_Mike


Udo Klein

You can use all 20 pins as outputs. However if you do not properly set the modes then what you describe might happen. Have a look at my basic sketcheshttp://blog.blinkenlight.net/experiments/basic-sketches/. Maybe you did not set the modes properly?
Check out my experiments http://blog.blinkenlight.net

war_spigot

If the pin isn't set up as an output, won't setting it high enable to 20k(I think) pullup resistor, severely limiting the current?

Grumpy_Mike

Quote
If the pin isn't set up as an output,

Then it is an input and has no output current at all.
Turning on and off the 30K pull up resistor may look like an output but will only supply a maximum of 0.16mA into a dead short. Much less into a real load.

Udo Klein

However as my experiments show 0.16mA is visible with efficient LEDs.
Check out my experiments http://blog.blinkenlight.net

Go Up