digitalWrite() - Arduino Reference#
digitalWrite() - Arduino Reference
Syntax#
digitalWrite(pin, value)
Parameters#
pin
: the Arduino pin number.
value
: HIGH
or LOW
.
Returns#
Nothing
Example Code#
The code makes the digital pin 13 an OUTPUT
and toggles it by alternating between HIGH
and LOW
at one second pace.
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
}