mdraber
Published © GPL3+

Using Pushbuttons with Arduino. Pullup vs Pulldown resistors

How to get rid of floating pin problem to make push button work properly

BeginnerFull instructions provided10,401
Using Pushbuttons with Arduino. Pullup vs Pulldown resistors

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Tactile Switch, SPST-NO
Tactile Switch, SPST-NO
×1
Resistor 10k ohm
Resistor 10k ohm
×1
LED (generic)
LED (generic)
×1

Story

Read more

Schematics

Pulldown resistor diagram

Pullup Resistor Diagram

Code

Code used to control led with Pushbutton

Arduino
Please watch video to observe slight changes to that coode to adjust LED behaviour, and also to activate using internal pullup resoistor
void setup() {
 pinMode(A0,INPUT);
 pinMode(9,OUTPUT);
}
void loop() {  
  if(digitalRead(A0)==HIGH) 
    digitalWrite(9,HIGH);
  else
    digitalWrite(9,LOW); 
}

Credits

mdraber

mdraber

49 projects • 65 followers

Comments