microswitch help

Status
Not open for further replies.

ltmhall

New Member
I recently bought a microswitch that has three pins common, normally open,
and normally closed. How would I connect them to a microcontroller.
Would I connect common to ground and the normally open or closed at my own descretion depending how I want it to work.
 
Normally you use pull-up resistors on a micro-controller, so common to ground (as you said) and the other two via seperate pull-up's to 5V, and also connected to two micro-controller inputs - so you can check either way.

However, this is rather a waste of two input pins, connecting just one will tell you the position of the switch - using either the normally open, or normally closed, is really up to you.
 
Some type of microcontroller cannot be left floating at their input. I would connect the common to the input, normally closed to ground and normally open to Vcc via a resistor.

Do you mean this (see attachment) When the switch is closed, the input of microcontroller is high or low or floating?

Thanks
 

Attachments

  • micro.GIF
    1.5 KB · Views: 420
bananasiong said:
Do you mean this (see attachment) When the switch is closed, the input of microcontroller is high or low or floating?

That's it, the pin can only be high or low, it can't float.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…