Arduino Programming Language: DigitalWrite

Name

digitalWrite()

Description

digitalWrite() sets 'HIGH' or 'LOW' the value of a digital output pin. 
In this example it is changed the value of pinOUT every second.

If the pin is configured as an INPUT, digitalWrite() will enable (HIGH) or disable (LOW) the internal pull-up resistor on the input pin. For more information on how to set the internal pull up resistors see Digital Pins.

Syntax

digitalWrite(pin,value)

Parameters

  • pin: pin number used
  • value: HIGH or LOW

Returns

none 

Usage

Application

Examples

int pinOUT = 3;

void setup()
{
pinMode(pinOUT, OUTPUT);
}

void loop()
{
digitalWrite(pinOUT, HIGH);
delay(1000);
digitalWrite(pinOUT, LOW);
delay(1000);
}

Related Functions


Based on the reference originally written by Arduino Community,  wiring.org.co and  arduino.cc