Skip to main content
edited tags
Link
m.Alin
  • 10.8k
  • 20
  • 65
  • 89
Tweeted twitter.com/#!/StackElectronix/status/236204556697092098
edited tags
Link
Bruno Ferreira
  • 4.5k
  • 2
  • 27
  • 37
Source Link
Sponge Bob
  • 5.3k
  • 17
  • 48
  • 65

Using SPST switch as digital input?

I am new to "electrical engineering" and I am working on a little arduino project. I want to have a SPST switch be used as a digital input on the board.

I have one of the switch leads connected to posative and the other connected to the digital input. The problem with this is that when the switch it off I can't be sure the input will be grounded. How can I make sure the input is grounded when the switch is off?

Would it work if I connected the digital input to a resistor that is connected to ground so when the switch is off it will be grounded, but when the switch is on it wont short out -- would that work?