pinMode(pin, pinMode) // Sets the pin to the mode defined.digitalRead(pin); // Reads the value from a specified digital pin,| Paramter | Details |
|---|---|
| pinmode | Should be set to INPUT or INPUT_PULLUP |
If the input pin is not pulled LOW or HIGH, the value will float. That is, it won't be clearly a 1 or a 0, but somewhere in between. For digital input, a pullup or pulldown resistor is a necessity.