How to connect a simple switch

I have a boarduino on a bread board, and i remember that there was a certain way switchs should be connected. Can someone please tell me how to simply connect a switch and led to the bread board so that when the switch is high the led is blinking and when it is low the led is just on. Thanks for all the help.

And see http://arduino.cc/en/Tutorial/Button for the "official" button tutorial. (That tutorial connects it to digital pin 2, while the photo above connects to digital pin 7.)

Once you get the button correctly wired, it's a simple matter to make your sketch use it to control the LED flashing/solid behavior.

Thank You so much, This is great

One quick question, can any resistor be used as a pull up resistor.

A 10K[ch937] is a common value for pullups or pulldowns. Free enough to pass some current but restrictive enough to avoid draining power.

The image is demonstrating a pull-down, which is common for beginners. If you can write your sketch to work with a reversed "active low" logic, you can engage the ATmega's internal pullup resistor (which is 20K[ch937]).

For connections like this... is it also "good" to use a small (100 ohm) resistor on the +5V to limit the input curent on a pin or is it not necessary? What about on analog inputs? I have burned one analog input a week ago, that's why I ask. (I'm glad I had a spare Atmega laying around...)

Regards,
Peter

The Arduino reference page on the topic mentions putting 100[ch937] between the input pin and just about anything. Lady Ada recommends the same thing in one of her tutorials. It's absolutely not necessary, but a rare situation might cause damage to the ATmega. To damage the ATmega, you'd have to wire straight to HIGH, configure your input as an output accidentally, and write a LOW to the output. If the pin is configured as an input (analog or digital), it will not be damaged by direct connection to true HIGH or true LOW. Exceeding AREF on analog inputs by a significant amount might cause damage.