07 Working with I/O Pins
digitalWrite()
Input/Output and Analog/Digital I/O Comparison
Pins in the Arduino controller can be configured as inputs or outputs. Additionally they can be either an analog or digital signal. The following table summarizes this variation and the commands used for each.
Write a HIGH or a LOW value to a digital pin.
If the pin has been configured as an OUTPUT with pinMode(), its voltage will be set to the corresponding value: 5V for HIGH, 0V (ground) for LOW.
NOTE: If you do not set the pinMode() to OUTPUT, and connect an LED to a pin, when calling digitalWrite(HIGH), the LED may appear dim. Without explicitly setting pinMode(), digitalWrite() will have enabled the internal pull-up resistor, which acts like a large current-limiting resistor.
digitalWrite(pin, value)
pin: the pin number
value: HIGH or LOW