How do I connect a 2 prong toggle switch to an LED on an Arduino UNO?

Hey, I'm pretty new to Arduino and I was wondering how to hook up my 2 prong toggle switch to an led on my UNO. :~ Would it work using the same way a push button plugs in? Could you please insert a diagram of how I would do it and if any programming needed, please notify me.

Thanks! ;)

It should be possible to treat it as a push-button- or momentary switch. The only difference is that you can leave the switch open or closed and walk away, something you can't with a momentary switch.

An example in programming can be found by clicking file -> examples -> 0.2 Digital -> Button when running the Arduino-IDE. Here you can find the schematics needed http://www.arduino.cc/en/Tutorial/Button You could use the debounce example in the 0.2 digital-menu as well.

Simpson_Jr: The only difference is that you can leave the switch open or closed and walk away, something you can't with a momentary switch.

That's basically what I'm after... So I would just hook it up as I would with a push button?

Yes.

The only difference is that the switch you're working with now can mechanically rest in 2 positions. Electronically there is no difference.

MAS3: Yes.

The only difference is that the switch you're working with now can mechanically rest in 2 positions. Electronically there is no difference.

Ok, thanks!

Skizzors:

Simpson_Jr: The only difference is that you can leave the switch open or closed and walk away, something you can't with a momentary switch.

That's basically what I'm after... So I would just hook it up as I would with a push button?

Yes and easiest way is to wire the switch between ground and the input pin you want to use. Then you need to enable the internal pull-up resistor for that pin number in your setup function.