NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Basic Electronics » Alternating LED circuit

January 27, 2011
by fiugrads2011
fiugrads2011's Avatar

I am trying to make two alternating LEDs. I am fairly new to electronics, and I am using the ATMEGA168-20pu microcontroller. I am very good in computer programming,and only need help with the electrical wiring, and I am wondering if anyone can show me a layout that I can look at so I can just connect wires in the breadboard to my microcontroller(i.e an electrical circuit layout).

January 27, 2011
by Hexorg
Hexorg's Avatar

What do you mean by alternating LEDs? When out of 2 LEDs only one is on at a time?

If so, easiest way is to connect it like this ( <| is LED):

MCU  PB5 ----<|------330_Ohm_resistor------VCC
MCU  PB4 ----<|------330_Ohm_resostor------VCC

then in code, when PB5 is 0 - connected LED will be on, when PB5 is 1 - off.

If you have some NOT gates you can make a circuit that will have 1 LED on when PB5 is 1, and another LED on, when PB5 is 0:

MCU PB5 --+--<|----330_ohm_resistor----VCC
          |
          +--NOT_GATE----<|---330_ohm_resistor----VCC
February 02, 2011
by fiugrads2011
fiugrads2011's Avatar

I have several more questions, I apologize as I am new to electrical circuits. 1. If I am using a 9V battery, how and where would I connect it to my microcontroller(Atmega 168-20pu). 2. How do I connect the USB to the microcontroller to program it, i.e what wires( black , Red, green, yellow) go where? to what pin ports? I am using pins PB5 & PB4 for output pins. 3. My computer tells me it cannot recognize the USB,i.e it cannot find the driver. What driver is required for the USB? and where can I find it ? (it is from the Nerdkits kit). 4. How do I connect my LCD display to show me the output times for my LEDS?

February 02, 2011
by Rick_S
Rick_S's Avatar

Have you read your NK guide?? Most of those questions would be answered in the basic setup explained in full in your guide. The drivers are available in the download area.

Rick

Post a Reply

Please log in to post a reply.

Did you know that the Timer/Counter modules on the microcontroller can be configured to output a PWM (Pulse Width Modulation) signal? Learn more...