Skip to main content
edited title
Link
gabi
  • 343
  • 2
  • 5
  • 17

AVR switch best practiceדpractice

Source Link
gabi
  • 343
  • 2
  • 5
  • 17

AVR switch best practiceד

After reading a lot of posts (here and on the web), I am a bit confused.
All I want to do is to get the best practice of push button connection to AVR.

I have 2 "sections" to my question. the first one is the HIGH or LOW connection, and the 2nd one is the resistor issue. I will start with the HIGH/LOW options:

  1. +5V --\ ----AVR : The AVR pin is set to LOW by default and checked if the pin is HIGH (so the switch is on).
  2. GND --\ ----AVR : The AVR pin is set to HIGH (Pull-up?), checking it for LOW to see click.

The 2nd section of the question is about the resistor, and if I need to use it.

  • If I am using the pin with HIGH value and by pushing the button it connected to groud,
    I saw some of the blogers put resistor before the button and connecting it to VCC:
    VCC_RES
    Do I need it? if so, what should be R1 value?

  • If I am setting the pin to LOW as default, should I use resistor as well, but connect it to GND?

Thanks guys..