What is INPUT_PULLUP?

tarafından
21475
What is INPUT_PULLUP?

You have certainly seen the INPUT_PULLUP command in many Arduino projects. It is a software command that is used when button inputs are not (physically) pulled onto the circuit.
In other words, we can imagine the terms “hardware” and “software” many times. In the IT field, all physical parts of the computer that are visible by hand are called hardware. Software, on the other hand, is referred to as the management of the hardware parts that make up the computer system and the community of commands that are necessary for the users to work. In a sense, we are closing the gap between hardware and software.

The black flash circle where we use the INPUT_PULLUP command can be found here. As we saw in our previous project, instead of putting a resistor between the pin where the button is connected to ground and bringing one leg of the button to 5 volts, we simply connected the button to ground and pin and instead of typing INPUT into the software, we wrote INPUT_PULLUP to make the button work. INPUT_PULLUP is my preferred method because I don’t want to add an extra cable to every button and make my breadboard more complicated in my projects.

Let us visualize the event so that we can better understand it:

In both cases the LED lights up evenly.



USAGE OF INPUT : USAGE OF INPUT_PULLUP:
void setup(){
pinMode(8, OUTPUT);
pinMode(4, INPUT);
}
void setup(){
pinMode(8, OUTPUT);
pinMode(4, INPUT_PULLUP);
}