Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Trumpkin on August 04, 2008, 11:23:31 AM

Title: Atmega 8 (or 168) programmable LED
Post by: Trumpkin on August 04, 2008, 11:23:31 AM
Is port d6 the right pin to connect an LED to if I want to program the LED?
Title: Re: Atmega 8 (or 168) programmable LED
Post by: pomprocker on August 04, 2008, 12:42:51 PM
you can connect an LED to any port
Title: Re: Atmega 8 (or 168) programmable LED
Post by: Trumpkin on August 04, 2008, 01:23:17 PM
So you can plug an LED into a port d, port b or port c? I thought it had to be port D.
Title: Re: Atmega 8 (or 168) programmable LED
Post by: bens on August 04, 2008, 02:06:45 PM
I don't know what you mean by "program the LED".  You pass current through an LED and it lights.  Since the mega8/168 can safely source or sink up to 40 mA with its digital I/O pins, it can light standard LEDs (which typically have good brightness at anywhere between 2 and 20 mA).

Connect your LED to any digital I/O pin you want (don't forget to put an appropriate resistor in series with the LED) and then drive that pin high to light the LED (assuming the other side of the series circuit is connected to ground).  Why would you think that you could only use port D pins?

- Ben
Title: Re: Atmega 8 (or 168) programmable LED
Post by: Trumpkin on August 04, 2008, 02:47:00 PM
Quote
You pass current through an LED and it lights.
that's what I meant when I said "program the LED".
Title: Re: Atmega 8 (or 168) programmable LED
Post by: pomprocker on August 04, 2008, 02:54:39 PM
Yeah I meant to say what Ben said but I didn't use as many words  :P