Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: Joker94 on December 23, 2009, 07:16:52 PM

Title: Conecting a Switch to a MCU
Post by: Joker94 on December 23, 2009, 07:16:52 PM
Hi everyone

I want to use a switch to start a program. And i have a few questions.

1)Does it have to be a momentary push button or can it be a toggle

2) how would i go about connecting it to the mcu pin, eg. can i use a sensor bus pin, what do the 2 terminals connect to etc.

all help greatly appreciated

Joker94
Title: Re: Conecting a Switch to a MCU
Post by: Razor Concepts on December 23, 2009, 07:37:15 PM
http://www.societyofrobots.com/sensors_tactbumpswitch.shtml (http://www.societyofrobots.com/sensors_tactbumpswitch.shtml)
Title: Re: Conecting a Switch to a MCU
Post by: SmAsH on December 23, 2009, 07:44:45 PM
One terminal connects to +5v, other to the pin. In between the mcu pin and the terminal, a 10k resistor to gnd.
The switch can be either, the program can be changed to cope.
Title: Re: Conecting a Switch to a MCU
Post by: madsci1016 on December 28, 2009, 10:06:54 PM
One terminal connects to +5v, other to the pin. In between the mcu pin and the terminal, a 10k resistor to gnd.
The switch can be either, the program can be changed to cope.

To simply further, just connect the 2 terminals of the switch, one to the pin, one to ground, and enable the internal pull-ups of the Micro controller. This eliminates the need for an external resistor.
Title: Re: Conecting a Switch to a MCU
Post by: Joker94 on December 28, 2009, 10:13:29 PM
brilliant thanks madsci1016

Joker94