Author Topic: Conecting a Switch to a MCU  (Read 1337 times)

0 Members and 1 Guest are viewing this topic.

Offline Joker94Topic starter

  • Supreme Robot
  • *****
  • Posts: 1,119
  • Helpful? 26
Conecting a Switch to a MCU
« 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

Offline Razor Concepts

  • Supreme Robot
  • *****
  • Posts: 1,856
  • Helpful? 53
    • RazorConcepts

Offline SmAsH

  • Supreme Robot
  • *****
  • Posts: 3,959
  • Helpful? 75
  • SoR's Locale Electronics Nut.
Re: Conecting a Switch to a MCU
« Reply #2 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.
« Last Edit: December 23, 2009, 07:46:10 PM by SmAsH »
Howdy

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: Conecting a Switch to a MCU
« Reply #3 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.

Offline Joker94Topic starter

  • Supreme Robot
  • *****
  • Posts: 1,119
  • Helpful? 26
Re: Conecting a Switch to a MCU
« Reply #4 on: December 28, 2009, 10:13:29 PM »
brilliant thanks madsci1016

Joker94