NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.
Project Help and Ideas » NerdKits with ATmega168 Port pin assignment
February 22, 2011 by vgphotog |
Before I go any farther with my Nerdkit I would like to understand "pin assignment". I have tried to
changed the pin used to flash the led. The code is from the kit project. I have tried changing the
port form "C" to "B" in the attached code. The program will compile and load but the led
on PORTB pin 4 will not flash. I copied the code and changed only the port letter. Why does it not work? I have also tried changing to a different pin on portc that does not work either. What am I missing?
|
---|---|
February 22, 2011 by SpaceGhost |
Is the anode (+) of your LED connected to pin 18, and the cathode (flat side) of the LED connected to the negative rail of your breadboard? Your code as it is written, should blink an LED connected to pin 18 on your MCU. |
February 22, 2011 by amartinez |
It worked for me. Your code looks good. I used PB1. |
February 22, 2011 by mongo |
An easy way to tell anode from cathode in an LED is to just look at the inner profile. The cathode would be the larger section of material on which the actual LED chip sits on. If you look really close, you might see the whisker that connects the anode lead to the actual anode of the LED. The anode lead is offset from the center and tha cathode is in the center of the package internally. |
February 23, 2011 by vgphotog |
Thank you all for taking the time to respond to my question. I owe you all an apology. In spite of the number of times that I checked the polarity of the LED it was wrong. The program does work. Again thank you. |
Please log in to post a reply.
Did you know that two resistors can be used to make a voltage divider? Learn more...
|