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.

Microcontroller Programming » Increasing and decreasing power from a pin

May 12, 2011
by drummingbum
drummingbum's Avatar

So basically I am trying to figure out a way to make and LED slowly light up and then fade out. I saw a video online of a project like this for Arduino. I am trying to figure out how to do this with just the microcontroller and this kit. How would I tell a specific pin to do this?

I know that the loop would have to increment the value of the current to a certain point and then decrement it until off. How do I control current though?

Thanks for any help.

May 12, 2011
by Ralphxyz
Ralphxyz's Avatar

Hi drummingbum, I believe you want to use PWM (phase width modulation), there are tons of discussion about PWM here in the forums and a lot of the Nerdkit's Tutorials use it.

Ralph

May 13, 2011
by drummingbum
drummingbum's Avatar

Thanks that is exactly what I'm looking for. It's hard to know what to ask when you don't know what you don't know!

May 13, 2011
by Ralphxyz
Ralphxyz's Avatar

Yes, but you did ask and I know exactly the frustration of not knowing what I am not knowing but knowing that I am not knowing something when I want to know something about something but I just do not know what to ask.

Gee that sounds like a modern day love song or at least the pains of growing up.

Been there done that, had that feeling.

By definition this state is called ignorance and this thread shows ignorance can be overcome by action.

Ignorance is not a put down it is where most of us came from and wanted to leave behind so we

participated in the Nerdkit's initiative to remove mcu ignorance from the world!

Ralph

May 13, 2011
by bretm
bretm's Avatar

See how to control an LED, near the bottom it shows how to control the brightness.

Post a Reply

Please log in to post a reply.

Did you know that reading a double floating point variable with scanf requires "%lf" for "long float"? Learn more...