Arduino Digital IO
Arduino Digital IO
Digital Input/output
Analog
Digital
What is digital?
• Digital signals are based on a 2 – value logic.
Everything is either TRUE or FALSE, ON or OFF
• digitalRead()
• digitalWrite()
pinMode()
• Description: Configures the specified pin to behave either as an
input or an output. See the description of digital pins for details
on the functionality of the pins.
• Syntax: pinMode(pin, mode)
• Parameters:
• pin = the number of the pin whose mode you wish to set
• mode = INPUT, OUTPUT, or INPUT_PULLUP
digitalWrite()
• Description: 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 (or 3.3V on
3.3V boards) for HIGH, 0V (ground) for LOW.
• Syntax: digitalWrite(pin, value)
• Parameters:
• pin = the pin number
• Value = HIGH or LOW
digitalRead()
• Description: Reads the value from a specified digital pin, either
HIGH or LOW.
• Syntax: digitalRead(pin)
• Parameters:
• Pin = the number of the digital pin you want to read (int)
• Returns: HIGH or LOW
Blink Example: Hardware
Blink Example : Code
Button example: Hardware
Button example: Code
More on buttons
• Button counter
Questions