Digital I/O Operations

Similar documents
Introduction to Arduino Diagrams & Code Brown County Library

Introduction to Arduino Diagrams & Code Brown County Library

More Arduino Programming

Arduino Part 2. Introductory Medical Device Prototyping

Arduino - DigitalReadSerial

PIC DESIGN (version 1) 2/11/2009

4x4 Matrix Membrane Keypad

SWITCH 10 KILOHM RESISTOR 220 OHM RESISTOR POTENTIOMETER LCD SCREEN INGREDIENTS

Prototyping & Engineering Electronics Kits Basic Kit Guide

SX1509 I/O Expander Breakout Hookup Guide

Arduino: LCD Diagrams & Code Brown County Library

Lesson 8: Digital Input, If Else

Objectives: Learn how to input and output analogue values Be able to see what the Arduino is thinking by sending numbers to the screen

IME-100 ECE. Lab 3. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

Specification. 1.Power Supply direct from Microcontroller Board. 2.The circuit can be used with Microcontroller Board such as Arduino UNO R3.

Introduction to Arduino

SPDM Level 2 Smart Electronics Unit, Level 2

IME-100 Interdisciplinary Design and Manufacturing

e-pg Pathshala Subject: Computer Science Paper: Embedded System Module: Interfacing External Devices using Embedded C Module No: CS/ES/22

Lab 5: LCD and A/D: Digital Voltmeter

Arduino 07 ARDUINO WORKSHOP 2007

Arduino 101 AN INTRODUCTION TO ARDUINO BY WOMEN IN ENGINEERING FT T I NA A ND AW E S O ME ME NTO R S

TANGIBLE MEDIA & PHYSICAL COMPUTING MORE ARDUINO

FUNCTIONS For controlling the Arduino board and performing computations.

Thumb Joystick Retail. Tools and parts you'll need. Things you'll want to know. How does it work? Skill Level: Beginner. by MikeGrusin March 22, 2011

Halloween Pumpkinusing. Wednesday, October 17, 12

8:1 Serial Port Expander

WEEK PRactice. Turning on LED with a Switch. Learning Objective. Materials to Prepare. Summary of Class. Project Goal. Hardware Expression

Lab-3: LCDs Serial Communication Analog Inputs Temperature Measurement System

BV4218. I2C-LCD & Keypad. Product specification. December 2008 V0.a. ByVac 2006 ByVac Page 1 of 9

Lab 5: LCD and A/D: Digital Voltmeter

8051 Intermidiate Development Board. Product Manual. Contents. 1) Overview 2) Features 3) Using the board 4) Troubleshooting and getting help

ONYX-MM-XT PC/104 Format Counter/Timer & Digital I/O Module

IOX-16 User s Manual. Version 1.00 April Overview

Lab 01 Arduino 程式設計實驗. Essential Arduino Programming and Digital Signal Process

Robotics and Electronics Unit 5

Adafruit 1-Wire GPIO Breakout - DS2413

3.The circuit board is composed of 4 sets which are 16x2 LCD Shield, 3 pieces of Switch, 2

VKey Voltage Keypad Hookup Guide

What s inside the kit

ArdOS The Arduino Operating System Quick Start Guide and Examples

Lab 2.2 Ohm s Law and Introduction to Arduinos

MedeaWiz 8X78. Input / Output Expander. FW version 1.0. PCB version 1.0. Manual version Note that this manual may change periodically

micro:bit Lesson 2. Controlling LEDs on Breadboard

IME-100 ECE. Lab 4. Electrical and Computer Engineering Department Kettering University. G. Tewolde, IME100-ECE,

Using a Temperature Sensor

Adapted from a lab originally written by Simon Hastings and Bill Ashmanskas

Microcontrollers and Interfacing week 8 exercises

LCD03 - I2C/Serial LCD Technical Documentation

ROBOTLINKING THE POWER SUPPLY LEARNING KIT TUTORIAL

Note. The above image and many others are courtesy of - this is a wonderful resource for designing circuits.

I2C interface Tutorial

Make your own secret locking mechanism to keep unwanted guests out of your space!

Laboratory 1 Introduction to the Arduino boards

Update: Ver 1.3 Dec Arduino Learning Guide For Beginner Using. Created by Cytron Technologies Sdn Bhd - All Rights Reserved

Introduction to Microcontrollers Using Arduino. PhilRobotics

Update: Ver 1.3 Dec Arduino Learning Guide For Beginner Using. Created by Cytron Technologies Sdn Bhd - All Rights Reserved

LCD03 - I2C/Serial LCD Technical Documentation

User's Manual. USB 2.0 Audio PCA with 16 Bit I/O, 4 x 4 Audio Mixer

CONTENTS BIGAVR2 KEY FEATURES 4 CONNECTING THE SYSTEM 5 INTRODUCTION 6

Layad Circuits Arduino Basic Kit B. Content Summary

Manual iaq-engine Indoor Air Quality sensor

University of Portland EE 271 Electrical Circuits Laboratory. Experiment: Arduino

DEV-1 HamStack Development Board

cs281: Introduction to Computer Systems Lab03 K-Map Simplification for an LED-based Circuit Decimal Input LED Result LED3 LED2 LED1 LED3 LED2 1, 2

Serial.begin ( ); Serial.println( ); analogread ( ); map ( );

ADC to I 2 C. Data Sheet. 10 Channel Analog to Digital Converter. with output via I 2 C

Monitor your home remotely using the Arduino

Procedure: Determine the polarity of the LED. Use the following image to help:

EE251: Thursday September 20

TN-192. Bar Graph shows analog trends on a dot-matrix character LCD module. Introduction. LCD Module Basics. Custom Characters

TABLE OF CONTENTS INTRODUCTION LESSONS PROJECTS

3. The circuit is composed of 1 set of Relay circuit.

LDR_Light_Switch5 -- Overview

Physical Computing Self-Quiz

EXPERIMENT 7 Please visit to learn all features of arduino before you start the experiments

Handson Technology. 2 Channel 5V Optical Isolated Relay Module. User Guide. 1

GammaTron USB Module

AVR Intermediate Development Board. Product Manual. Contents. 1) Overview 2) Features 3) Using the board 4) Troubleshooting and getting help

Which LED(s) turn on? May 4, 2018 E40M Spring 2018 T. Diamandis, J. Plummer, R. Howe, C. Z. Lee 1

Smart Objects. SAPIENZA Università di Roma, M.Sc. in Product Design Fabio Patrizi

Basic Input/Output Operations

CHAPTER 12 LCD AND KEYBOARD INTERFACING

GUIDE TO SP STARTER SHIELD (V3.0)

Laboratory 5 Communication Interfaces

MAE106 Laboratory Exercises Lab # 1 - Laboratory tools

MIDI CPU Hardware Rev K. User Manual

How-To: Make an RGB combination door lock (Part 1)

Arduino Uno Microcontroller Overview

KNOCK LOCK MAKE YOUR OWN SECRET LOCKING MECHANISM TO KEEP UNWANTED GUESTS OUT OF YOUR SPACE! Discover: input with a piezo, writing your own functions

RoboSpecies Technologies Pvt. Ltd.

Homework 5: Circuit Design and Theory of Operation Due: Friday, February 24, at NOON

Chapter 11: Interrupt On Change

ARDUINO MINI 05 Code: A000087

1/Build a Mintronics: MintDuino

Contents at a Glance.

Embedded Workshop 10/28/15 Rusty Cain

Robotics/Electronics Review for the Final Exam

ELEC 3040/3050 Lab 5. Matrix Keypad Interface Using Parallel I/O

I2CMux Grove Board 0057-GRV4I2CMux-DSBT/ SF

Transcription:

Digital I/O Operations CSE0420 Embedded Systems By Z. Cihan TAYŞİ Outline Digital I/O Ports, Pins Direction Pull-up & pull-down Arduino programming Digital I/O examples on Arduino 1

Digital I/O Unlike analog signals, which may take on any value within a range of values, digital signals have two distinct values: HIGH (1) or LOW (0). You use digital signals in situations, where the input or output will have one of those two values. For example, one way that you might use a digital signal is to turn an LED on or off. Digital I/O pins can be used for either input or output so you should set the direction of i/o pings Digital I/O (Pull-up & Pull-down) The two switches, a and b, represent the inputs to a generic logic gate. When switch a is closed (ON), input A is connected to ground, (0v) or logic level 0 (LOW) and likewise, However, when switch a is opened (OFF), what will be the value of the voltage applied to input A, HIGH or LOW? We assume it will be +5V (HIGH) as switch a is open-circuited and therefore input A is not shorted to ground, but this may not be the case. As the input is now effectively unconnected from either a defined HIGH or LOW condition, it has the potential to float about between 0V and +5V (Vcc) This uncertain situation may cause the digital input at A to stay at a logic level 0 (LOW) when the switch is open, when we actually need a logic 1, (HIGH) causing the logic gate to falsely switch the output at Q. Also once there, this floating and weak input signal could easily change value at the slightest of interference or noise from its neighbouring inputs or could even cause it to go into oscillation, rendering the gate practically unusable. 2

Aurduino Programming I The basic structure of the Arduino programming language is fairly simple and runs in at least two parts void setup() void loop() setup() is the preparation, loop() is the execution. Both functions are required for program to work. Aurduino Programming II The setup() function called once, when your program starts. It must be included in the program even if there are no statements to run. Use it to initialize pin modes setup serial connection After calling the setup() function, the loop() function does what its name suggests, and loops consectively. 3

Digital I/O on Arduino pinmode(pin, direction); used to configure a specified pin to behave either as an INPUT or OUTPUT. digitalread(pin); reads the value from a specified digital pin with result either HIGH or LOW. digitialwrite(pin, value); outputs either logic level HIGH or LOW at a specified digital pin. delay(); pauses your program for the among of time as specified in miliseconds, where 1000 equals second milis(); returns the number of miliseconds since the Arduino board began running the current program as an unsigned long value Arduino Example #1 Blinking LED Hardware Required 1 x LED 1 x 220 ohm resistor 1 x Arduino UNO 1 x breadboard 2 x jumper Wires 4

Arduino Example #1 const int led = 8; //use digital I/O pin 8 void setup() { pinmode(led,output); } // set pin 8 to be an output void loop() { delay(1000); //delay 1000 milliseconds digitalwrite(led,high); // turning on LED delay(1000); // delay 1000 milliseconds digitalwrite(led,low); // turning off LED } Arduino Example #2 Turn on/off LED Hardware Required 1 x LED 2 x 220 ohm resistor 1x pushbutton switch 1 x Arduino UNO 1 x breadboard 6 x jumper Wires 5

Arduino Example #2 const int led = 8; //name pin 8 as led const int button = 9; //name pin 9 as button void setup() { pinmode(led,output); //set pin 8 as OUTPUT pinmode(button,input) ; //set pin 9 as INPUT } void loop() { int reads = digitalread(button); //read the digital value on pin 9 digitalwrite(led,reads); //set the digital output value of pin 8 to that value } Arduino Example #3 Alter last example Write an application that changes the state (on/off) of the led, when the button is pressed initial status, the led is off when the button is pressed, the led turns on when the button is pressed again, the led turns off if the button pressed again, the led changes its state again Pin 13 is already connected to onboard LED Pin 2 is used for button 6

Arduino Example #4 Interfacing a 2x16 LCD Hardware Required 1 x Arduino UNO 1 x breadboard 16 x 2 LCD display 5k potentiometer Several jumper cables Arduino Example #4 Data Bus: As shown in the figure, an alphanumeric LCD has an 8-bit data bus referenced as D0-D7. As it is an 8-bit data bus, we can send the data/cmd to LCD in bytes. It also provides the provision to send the data/cmd in chunks of 4-bit, which is used when there are limited number of GPIO lines on the microcontroller. Register Select(RS): The LCD has two register namely a Data register and Command register. Any data that needs to be displayed on the LCD has to be written to the data register of LCD. Command can be issued to LCD by writing it to Command register of LCD. Read/Write(RW): This signal is used to write the data/cmd to LCD and reads the busy flag of LCD. For write operation the RW should be LOW and for read operation the R/W should be HIGH. Enable(EN): This pin is used to send the enable trigger to LCD. 7

10/10/18 Arduino Example #4 Arduino Example #5 A Simple Keyboard Hardware Required 1 x Arduino UNO 1 x breadboard 4 buttons Several jumper cables Serial connection 8

Arduino Example #5 Matrix keypads use a combination of rows and columns to provide button states to the microcontroller. Underneath each key is a pushbutton, with one end connected to one row, and the other end connected to one column. In order for the microcontroller to determine which button is pressed, it first needs to pull each of the four columns (pins 1-4) either low or high one at a time, and then poll the states of the four rows (pins 5-8). Depending on the states of the columns, the microcontroller can tell which button is pressed. Arduino Example #5 9

References https://www.allaboutcircuits.com/projects/learn-how-to-use-thearduinos-digital-i-o/ https://playground.arduino.cc/uploads/main/arduino_notebook_v1-1.pdf https://maker.robotistan.com/arduino-dersleri-10-16x2-lcd-ekran/ http://osoyoo.com/2017/09/13/arduino-lesson-4x4-matrix-keypad/ 10