pinMode() - Arduino Reference#

pinMode() - Arduino Reference

Syntax#

pinMode(pin, mode)

Parameters#

pin: the Arduino pin number to set the mode of.
mode: INPUT, OUTPUT, or INPUT_PULLUP. See the Digital Pins page for a more complete description of the functionality.

Example Code#

The code makes the digital pin 13 OUTPUT and Toggles it HIGH and LOW

void setup() {
  pinMode(13, OUTPUT);    // sets the digital pin 13 as output
}

void loop() {
  digitalWrite(13, HIGH); // sets the digital pin 13 on
  delay(1000);            // waits for a second
  digitalWrite(13, LOW);  // sets the digital pin 13 off
  delay(1000);            // waits for a second
}