Simple tutorial for pushbutton-controlled LED

I would like a simple tutorial for an Arduino sketch and circuit (the latter is what I mainly don't understand) where the Arduino receives input from a pushbutton and toggles an LED based upon that.

It should have:

  • The parts list
  • The LED on a pin other than 13 (because 13 has the built in resistor apparently and I don't want to be dependent on pin 13)
  • The circuit diagram, (a picture would be best) in the form a programmer who is an idiot with physical circuits can understand
  • Tell me why certain resistors go where, and why they need to have whatever amount of resistance they have!

Thanks!
:slight_smile:

Here's some hookup examples with brief decripion ...

Chicken325,

I just red your previois posts, and seems to like you need to consentrate a bit with the basic electronics.

You need to understand three things, and their interpedencies.
-Resistance, ohms
-Voltage, volts
-Current, amperes

These are the key for all your first question, what is the resistor I need for my LED.

Then, you can use your skills (you say you are a good programmer) to read digital input to find out if the button is pressed, and turn that information for instructions to turn either digital or analog output on.

How about that? After you have done some Ohms law calculations, I will, as a beginner with MCU's, help you a bit more ahead. In no time, I can't help you enymore, and there thousands of people who can.
:slight_smile:

What you need to know now, is that Digital output gives you 5V, and let's assume that your LED need 10mA with 3 volts to light your day, what is the total resistance to avoid burning things? Don't use actual components to test that, try to find a way to calculate that.

Kari