0

very odd LED behavior..
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

very odd LED behavior..

by rizla420 on Tue Feb 24, 2009 9:59 pm

alright, so i'm moving along slowly but surely.. I've messed around with LED's and have done the blink tutorials have used the shiftOut registers so i sort of know whats going on. I'm trying to an a last piece to my project, but i'm getting some funky led behavior.

Here's the scenario, i have a connection going from Ground > LED > 150ohm resis > VCC.

In a typical setup that works, for some reason its not. This is where it gets weird.

Ground > LED > VCC LED works (dont worry i dont leave it on long to burn, just to test)

Lastly, the super funk party

Ground > jumper cable > LED > Jumper cable > VCC It shorts the entire board and my arduino turns off. I unplug the jumper cable and everything back on.

Why is doing the exact same connection Ground > LED > VCC work, but Ground > jumper > LED > jumper > VCC shorting the board? I thought maybe it was bad jumper wires so i snipped some new ones to no avail.

rizla420
 
Posts: 332
Joined: Thu Feb 05, 2009 9:03 pm

Re: very odd LED behavior..

by rizla420 on Tue Feb 24, 2009 11:02 pm

Turns out I have a faulty row in my bread board.. is it frequent that you have bad connections on a breadboard? THis is a second breadboard that I have that has a quirk in it.

rizla420
 
Posts: 332
Joined: Thu Feb 05, 2009 9:03 pm

Re: very odd LED behavior..

by Ran Talbott on Tue Feb 24, 2009 11:25 pm

Hmmm, sounds like you released the Magic Smoke from the LED, and it shorted when it failed. Does it light up with the 150 Ohm resistor in the circuit?

If it's shorted, it can send the voltage regulator into over-current shutdown, which would produce just the sort of symptoms you're seeing when you plug it back in with the jumper wire.

Ran
Ran Talbott
 
Posts: 57
Joined: Thu Feb 19, 2009 1:32 pm

Re: very odd LED behavior..

by rizla420 on Wed Feb 25, 2009 12:36 am

Ran Talbott wrote:Hmmm, sounds like you released the Magic Smoke from the LED, and it shorted when it failed. Does it light up with the 150 Ohm resistor in the circuit?

If it's shorted, it can send the voltage regulator into over-current shutdown, which would produce just the sort of symptoms you're seeing when you plug it back in with the jumper wire.

Ran


NOpe, the LED's are fine, i moved the cathode up a row and the connected it with a jumper and it works... no clue man. Glad i got it to work.. now if i can only figure out how to make them blink without using the delay function. I'm one step closer..

rizla420
 
Posts: 332
Joined: Thu Feb 05, 2009 9:03 pm

Re: very odd LED behavior..

by magician13134 on Wed Feb 25, 2009 8:20 pm

I'm just curious, what's wrong with the delay function?
magician13134
 
Posts: 1119
Joined: Wed Jun 13, 2007 9:17 am
Location: Ann Arbor

Re: very odd LED behavior..

by rizla420 on Wed Feb 25, 2009 9:09 pm

magician13134 wrote:I'm just curious, what's wrong with the delay function?


LOL, good question... to which i dont really have a legit answer too. Its just that when i had blinking LED using the delay function and trying to capture input from some pushbuttons there would be a delay on how quickly it would register the button press, if i set the delay too high, like every 500ms +

rizla420
 
Posts: 332
Joined: Thu Feb 05, 2009 9:03 pm

Re: very odd LED behavior..

by The_Don125 on Thu Feb 26, 2009 7:32 pm

Well, when you use the delay() function, what you are effectively doing is having the Arduino perform hundreds of "no operation" cycles where it sits there and does nothing for the specified time. A pin-read requires its own instruction cycle, so while the microcontroller is stuck in a loop of "no operation" cycles, it can't read the button.

The good way to blink an LED and read a button is use interrupts. Basically, the microcontroller sits idle, then when the ATMega's timer hits a certain value, it triggers an interrupt to change the state of the LED. If the state of the button pin changes, it signals an interrupt to do something else. Unfortunately I don't know how to do interrupts on an Arduino, so maybe someone else can offer advice here.
The_Don125
 
Posts: 373
Joined: Tue Mar 06, 2007 11:51 pm
Location: Illinois

Re: very odd LED behavior..

by rizla420 on Thu Feb 26, 2009 9:44 pm

The_Don125 wrote:Well, when you use the delay() function, what you are effectively doing is having the Arduino perform hundreds of "no operation" cycles where it sits there and does nothing for the specified time. A pin-read requires its own instruction cycle, so while the microcontroller is stuck in a loop of "no operation" cycles, it can't read the button.

The good way to blink an LED and read a button is use interrupts. Basically, the microcontroller sits idle, then when the ATMega's timer hits a certain value, it triggers an interrupt to change the state of the LED. If the state of the button pin changes, it signals an interrupt to do something else. Unfortunately I don't know how to do interrupts on an Arduino, so maybe someone else can offer advice here.


Thanks for the pointer, but it seems like we're in the same boat. I've read briefly about the advantages of using interrupts, but dont know enough to use it effectively.. oh well. for the time being i'll have to figure out how to blink using millis..

rizla420
 
Posts: 332
Joined: Thu Feb 05, 2009 9:03 pm

Re: very odd LED behavior..

by eil on Thu Feb 26, 2009 10:38 pm

No need to bother with interrupts. Check the examples that come with Arduino, there should be one called something like "Blink without delay". It simply starts a timer and when the timer reaches the specified interval, the state of the LED is toggled. The loop is kept running so you're free to watch for button presses, etc.
eil
 
Posts: 440
Joined: Sun Aug 31, 2008 11:09 pm

Re: very odd LED behavior..

by rizla420 on Fri Feb 27, 2009 11:08 am

eil wrote:No need to bother with interrupts. Check the examples that come with Arduino, there should be one called something like "Blink without delay". It simply starts a timer and when the timer reaches the specified interval, the state of the LED is toggled. The loop is kept running so you're free to watch for button presses, etc.



I know about the code for blinking without delay and thats the problem. I cant get it to work correctly using shift registers in conjuction with the code..

rizla420
 
Posts: 332
Joined: Thu Feb 05, 2009 9:03 pm

Re: very odd LED behavior..

by karlgg on Fri Feb 27, 2009 3:33 pm

rizla420 wrote:Turns out I have a faulty row in my bread board.. is it frequent that you have bad connections on a breadboard? THis is a second breadboard that I have that has a quirk in it.


I wonder if maybe you're confusing the rows with buss-lines or such? Generally most problems with solderless breadboards is that the connections are loose (because they wear, or are bent too far open inside), much harder to imagine they're shorting lines together internally. Unless you've had some terrible luck (or a terrible manufacturer).
I think I am, therefore I am... I think.

karlgg
 
Posts: 212
Joined: Sat Dec 27, 2008 2:41 pm
Location: Anthony, NM

Re: very odd LED behavior..

by octelcogopod on Fri Mar 06, 2009 5:39 pm

if you think your breadboard is partially bad, flip it and remove the metal row, then clean and rebend the contacts and reinsert (assuming you have the plastic kind, the most common)
YOU'RE A WINNER
Image
(obnoxious sig crew reprazent)
octelcogopod
 
Posts: 192
Joined: Tue Jan 30, 2007 5:14 am

Please be positive and constructive with your questions and comments.