arduino Digital Inputs

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • pinMode(pin, pinMode) // Sets the pin to the mode defined.
  • digitalRead(pin); // Reads the value from a specified digital pin,

Parameters

ParamterDetails
pinmodeShould be set to INPUT or INPUT_PULLUP

Remarks

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.



Got any arduino Question?