This library is to input/output a digital signal (0 or 1).

pinMode

Description

Configures the specified pin to behave either as an input or an output.

Syntax

pinMode(pin, mode)

Parameters

pin: The number of the pin whose mode you wish to set
mode: INPUT, OUTPUT, or INPUT_PULLUP

Returns

None

Remark

Analog pins A0 to A5 (14 to 21) have no internal pull-up registers. Do not specify INPUT_PULLUP for these pins.

digitalWrite

Description

Write a HIGH or a LOW value to a digital pin. If the pin is configured as an INPUT, writing a HIGH value with digitalWrite() will enable an internal pullup resistor. Writing LOW will disable the pullup.

Syntax

digitalWrite(pin, value)

Parameters

pin: The pin number
value: HIGH or LOW

Returns

none

digitalRead

Description

Reads the value from a specified digital pin, either HIGH or LOW.

Syntax

digitaRead(pin)

Parameters

pin: The number of the digital pin you want to read

Returns

HIGH or LOW


Example

LED 13 is lit periodically.


        #include <Arduino.h>
        void setup()
        {
            pinMode(13, OUTPUT);
        }
            
        void loop()
        {
            digitalWrite(13, HIGH);
            delay(100);
            digitalWrite(13, LOW);
            delay(100);
        }