![Down Down](/uploads/1/2/5/5/125561924/165557777.png)
Guide to use Pull up and Pull down resistor in a digital circuit. Calculation of these resistor values explained with a digital logic gate. And the things to avoid while implementing your digital. Pull-up and Pull-down resistors What is a Resistor? The Resistor is a most commonly used component in many electronic circuits and electronic devices. The main function of the resistor is, it restricts the flow of current to other components. The resistor works on the principle of ohms law which states that dissipation due to the resistance.
With this little test I hope you'll understand why the pull-up (and pull-down) resistors are needed in digital circuits like in Arduino.
With a pull-up resistor and with the button unpressed you make a logic state ON and with the button pressed you make a logic OFF.
With a pull - down resistor and a pressed button you make an ON logic state and OFF logic state when its unpressed.
Make the above pull-up circuit and try the code. You'll see the LED flickering or less bright.
Pressing the button and you see now the LED turned normaly on (fully bright). Turning off the button and the LED its flickering again.
Pressing the button and you see now the LED turned normaly on (fully bright). Turning off the button and the LED its flickering again.
/*Pull-up resistor test*/
![Pull down resistor size Pull down resistor size](/uploads/1/2/5/5/125561924/565735248.png)
int buttonPin = 3;
int Led = 10;
int Led = 10;
void setup() {
pinMode(buttonPin,INPUT);
pinMode(Led,OUTPUT);
Serial.begin(9600);
}
pinMode(buttonPin,INPUT);
pinMode(Led,OUTPUT);
Serial.begin(9600);
}
void loop() {
int buttonState = digitalRead(buttonPin); //read the state of the button input
if (buttonState LOW) { // if the button is pressed it is low state
digitalWrite(Led,HIGH); //see flickering led or less bright
} else {
digitalWrite(Led,LOW);
Serial.println(buttonState);
}
}
int buttonState = digitalRead(buttonPin); //read the state of the button input
if (buttonState LOW) { // if the button is pressed it is low state
digitalWrite(Led,HIGH); //see flickering led or less bright
} else {
digitalWrite(Led,LOW);
Serial.println(buttonState);
}
}