Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
37 views

Arduino Digital IO

This document provides an overview of digital input/output on the Arduino board. It begins by distinguishing between digital and analog signals, noting that digital signals are binary (on/off) while analog signals represent varying degrees. It then discusses how digital signals are represented by voltage levels, with Arduino reading voltages between 2.6-5V as high and 0-2.1V as low. The core Arduino digital I/O functions - pinMode(), digitalRead(), and digitalWrite() - are described. Examples of blinking an LED and reading a button press are presented to demonstrate basic digital I/O usage.

Uploaded by

Paolo Peps
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Arduino Digital IO

This document provides an overview of digital input/output on the Arduino board. It begins by distinguishing between digital and analog signals, noting that digital signals are binary (on/off) while analog signals represent varying degrees. It then discusses how digital signals are represented by voltage levels, with Arduino reading voltages between 2.6-5V as high and 0-2.1V as low. The core Arduino digital I/O functions - pinMode(), digitalRead(), and digitalWrite() - are described. Examples of blinking an LED and reading a button press are presented to demonstrate basic digital I/O usage.

Uploaded by

Paolo Peps
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Arduino:

Digital Input/output

Toby, Samuel and Dolapo


Digital vs. Analog
• Binary vs. continuous signals
• Binary/Digital = “whether or not”
• Continuous/Analog = “how much” or “faster”,
“brighter”, etc.
Analog Vs. Digital

Analog

Digital
What is digital?
• Digital signals are based on a 2 – value logic.
Everything is either TRUE or FALSE, ON or OFF

• It is how computers calculate and reason

• Example of digital signals


Digital signals as voltage
• Digital hardware read voltage as either high or low
• The middle range is usually not understood and gives
unpredictable readings.
Digital signal as Voltage Cont.
• The actual value of these voltage differ in different families of
devices
• TTL use voltage range of 0- 5V, while CMOS use 0-3.3V.
Arduino Digital I/O
Arduino I/O Voltages
• They are very flexible
• Digital inputs can be considered perfect measuring devices if
they draw no current and interpret the voltage 2.6 – 5V as
HIGH and 0 – 2.1V as LOW
Arduino Digital Output

• Most designs involve digital I/O pins


Using Digital Pins on Arduino
• pinMode()

• 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 and serial

• Button counter
Questions

You might also like