Pages: [1]   Go Down
Author Topic: First LED Chaser and Curious Problem  (Read 759 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31436
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31436
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 14
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31436
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is this the sort of thing you mean:-
http://arduino.cc/en/Hacking/PinMapping?from=Main.PinMapping
Logged

0
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3420
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Check out my experiments http://blog.blinkenlight.net

Arkansas, US
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
I only ever use XAND and XNAND gates.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31436
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Faraday Member
**
Karma: 19
Posts: 3420
20 LEDs are enough
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

However as my experiments show 0.16mA is visible with efficient LEDs.
Logged

Check out my experiments http://blog.blinkenlight.net

Pages: [1]   Go Up
Jump to: