Input Pullup Serial using Arduino
This example demonstrates the use of INPUT_PULLUP with pinMode(). It monitors the state of a switch by establishingserial communication between your Arduino and your computer over USB.
Additionally, when the input is HIGH, the onboard LED attached to pin 13 will turn on; when LOW, the LED will turn off.
Connect two wires to the Arduino board. The black wire connects ground to one leg of the pushbutton. The second wire goes from digital pin 2 to the other leg of the pushbutton.
Pushbuttons or switches connect two points in a circuit when you press them. When the pushbutton is open (unpressed) there is no connection between the two legs of the pushbutton. Because the internal pull-up on pin 2 is active and connected to 5V, we read HIGH when the button is open. When the button is closed, the Arduino reads LOW because a connection to ground is completed.
In the program below, the very first thing that you do will in the setup function is to begin serial communications, at 9600 bits of data per second, between your Arduino and your computer with the line:
Next, initialize digital pin 2 as an input with the internal pull-up resistor enabled:
The following line make pin 13, with the onboard LED, an output :
For more detail: Input Pullup Serial using Arduino
This Post / Project can also be found using search terms:
- input_pullup in arduino
- arduino input_pullup
- https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1821 3bBmsEMdksdo47-HEKRe27QqtDA9lWujD4LJNdax0Cy036L9S9pQ5jbua7bTL0Co 2461c5383d41207e43594c6d225fd62a3cd97abc&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme
- https://yandex ru/clck/jsredir?from=yandex ru;search;web;;&text=&etext=1822 xlHxR0t_q-X1o5k48G115XtgQIJdR9yZrElB3mhxmkeSIuMa6ne8iW61KdGqEC4C cda4d9cb691d95d32c2d812643b0fc9d0880b0b6&uuid=&state=_BLhILn4SxNIvvL0W45KSic66uCIg23qh8iRG98qeIXme