You are on page 1of 34

Getting started with

Arudino
S H A S H I K A L O K U L I YA N A , M . S C . ( I T ) S L I I T, B . S C . ( S P. ) H O N S I N I T ( S P E C . I N C S N ) ( S L I I T ) , M I E E E , M C S S L
SENIOR LECTURER
D E PA R T M E N T O F I N F O R M AT I O N S Y S T E M S E N G I N E E R I N G , FA C U LT Y O F C O M P U T I N G
S R I L A N K A I N S T I T U T E O F I N F O R M AT I O N T E C H N O L O G Y
NEW KANDY ROAD , MALABE , SRI LANKA 10115
E : S H A S H I K A . L @ S L I I T. L K
P: 011754-4141
Imagination into Action
Welcome to Arudino
What is Arudino
Physical Board
What is Arudino

Microcontroller
What is it??
What is Arudino
Arudino Board

Input Output
What is Arudino
USB port
• Connecting the unit to the
computer,
• Powering the board
• Uploading programmer
sketches
• Communication
What is Arudino
Power Connector
• Providing power to the Arudino
board when not pluged into
the USB.
• 9V~15V and check the voltage
regulator beside it
What is Arudino
Power Pins (aka Voltage Pins)
• Power up any circuit
What is Arudino
Reset Button
• Used to reset the board back
to its default state and for
debugging purposes
What is Arudino
Input and output interfaces
• 14 digital interfaces
• 6 for pulse width modulation (
marked on Arudino using the
tilde before the digital pin
number)
What is Arudino
Input and output interfaces
• 6 analog inputs (marked by a
letter “A” beside the pin
umber)
What is Arudino
3 Inbuilt LEDs’
• Green LED (marked ON)
• used to indicate when the
Arudino is receiving power
• used for debugging
What is Arudino
3 Inbuilt LEDs’
• 2 Yellow LED (marked TX and
RX)- indicates when receiving
or sending data between the
board and the computer
What is Arudino
3 Inbuilt LEDs’
• Yellow LED (marked L)
• Connected to digital
output pin number 13
• Used for a simple program
• Used for debugging
What is Arudino
Atmega Microcontroller
• Brain of the board
• Runs the programs
you create
• Complete
microcontroller
system in one chip –
check specs
What is Arudino
Digital Interfaces
What is Arudino
Digital Interfaces
• Can be used for secondary
purposes depending on the
program and micro-controller.
e.g.
• Pin 0 – RX
• Pin 1 – TX

(more on serial communication


later)
What is Arudino
Digital Interfaces
PWM
• Used for applications like
running water
• 6 pins used
• Pin 3,5,6,9,10,11 (marked
with tilde)
Arudino IDE
setup()
•This is the first function called by the program and also the first to run
•Runs’ only runs’ once it a program lifetime.
•Used to initiate input/output pins so they are ready to be used
Arudino IDE
loop()
•The program calls the code inside the loop function repeatedly until the Arudino
board is powered off.
•Place the main code here
•Hear of the sketches where it defines what to perform
Setting Input or Ouput Modes

pinMode(pin,mode)
•Used to define whether a pin will be acting as an input or an output.
•Pin – pin number to configure
•Mode – operating condition
• INPUT : set it as input
• INPUT_PULLUP : Set it as input-using an internal pull-up resistor
• OUTPUT : Set it as output
Setting Input or Ouput Modes

Example
Setting Input or Ouput Modes

Example
Setting Input or Ouput Modes

digitalWrite(pin,value)
•Use it if the digital pin has been configured as an output usign pinMode()
•The function display or output the value on that specific pin.
•Pin – pin number to configure
•Value – high or low
• HIGH : logic 1
• LOW : logic 0
Setting Input or Ouput Modes

Example
Setting Input or Ouput Modes

Example
Try it out

Write a program to blink the in-built Yellow LED (L) which is


connected to the digital pin 13.
Try it out
Digital traffic signal example: Look at the
circuit configuration and the operating
conditions are as follows:
beginning all LED should be low.
ØFirst light up Yellow LED for 1s
ØSecond Green LED for 2 s
ØThird Red LED for 2 s
ØLoop back

1. Draw a flow chart for your program


execution .
2. Use the IDE to develop the code.
What are Libraries?
Libraries are a collection of code that makes it easy for you
to connect to a sensor, display, module, etc. For example,
the built-in LiquidCrystal library makes it easy to talk to
character LCD displays. There are hundreds of additional
libraries available on the Internet for download.
How to install a Library – Using library
manager
Open the IDE and click to the "Sketch" menu and
then Include Library > Manage Libraries.
Then the Library Manager will open and you will
find a list of libraries that are already installed or
ready for installation. In this example we will install
the Bridge library. Scroll the list to find it, click on it,
then select the version of the library you want to
install. Sometimes only one version of the library is
available. If the version selection menu does not
appear, don't worry: it is normal.
How to install a Library – Using library
manager
Finally click on install and wait for the IDE to install the new library. Downloading
may take time depending on your connection speed. Once it has finished,
an Installed tag should appear next to the Bridge library. You can close the
library manager.

Importing a .zip Library


Manual installation
How to install an Arduino or Genuino
core
Arudino board cores are already available in the
Boards Manager and are updated on every new
Arduino Software (IDE) release.
Click on Tools menu and then Board > Boards
Manager.
Boards manager will open and you will see a list of
installed and available boards; the download of the
index file could take some time and the list appears
at the end of this process; please be patient.
Click on the Arduino SAM Boards core, choose the
version in the drop-down menu and click on
Install.
Thank you

You might also like