From the course: Learning Arduino: Foundations

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

pinMode()

pinMode()

- [Instructor] Now let's try to understand some of the main commands used with an Arduino IDE. You can use each digital interface on the Arduino as either input or an output, but not both at the same time. Now, in order to tell Arduino which mode your sketch uses for the specific digital or analog interface, we need to use pinMode function. In pinMode function, we basically configure at the specific pin in Arduino to behave either as an input or an output. This is the way the function is written. The pinMode function requires two parameters. The pin parameter determines the pin member to configure. The mode parameter determines whether the pen operates as an input or an output. There are three values you can use for the interface mode setting. INPUT in order to set it for a normal input mode, INPUT_PULLUP is in order to set it for an input mode, but uses an internal pull-up resistor. I'll talk more about this later in…

Contents