SlideShare a Scribd company logo
Department of Electrical and Electronic
Engineering
Khulna University of Engineering & Technology
Khulna-9203
Course code : EE 3214
Sessional on
Microprocessors, Micro-controllers and Peripherals
Presented By
Amit Kumer Podder
Experiment No. 09
(a) Introduction to Arduino board and Arduino IDE
(b) Design and implementation of blinking LED,
analog voltage measurement, string operation and
traffic controller projects in Arduino environment
Experiment Name
Arduino is a prototype platform (open-source) based on an easy-
to-use hardware and software. It consists of a circuit board,
which can be programed (referred to as a microcontroller) and a
ready-made software called Arduino IDE (Integrated
Development Environment), which is used to write and upload
the computer code to the physical board.
Arduino
Arduino & Arduino Compatible Boards
Arduino Family
Arduino Pin Diagram
Arduino Software Outlet
Settings: Tools  Serial Port
•Your computer communicates
to the Arduino microcontroller
via a serial port  through a
USB-Serial adapter.
•Check to make sure that the
drivers are properly installed.
•Next, double-check that the proper board is selected under the
ToolsBoard menu.
Settings: Tools  Board
Arduino
Integrated Development Environment (IDE)
Two required functions /
methods / routines:
void setup()
{
// runs once
}
void loop()
{
// repeats
}error & status messages
Comments, Comments, Comments
• Comments are for you – the programmer and your
friends…or anyone else human that might read your code.
• // this is for single line comments
• // it’s good to put a description at
the top and before anything ‘tricky’
• /* this is for multi-line comments
• Like this…
• And this….
• */
comments
Comments, Comments, Comments
digitalWrite()
analogWrite()
digitalRead()
if() statements / Boolean
analogRead()
Serial communication
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States License.
BIG6CONCEPTS
Three commands to know…
• pinMode(pin, INPUT/OUTPUT);
• ex: pinMode(13, OUTPUT);
• digitalWrite(pin, HIGH/LOW);
• ex: digitalWrite(13, HIGH);
• delay(time_ms);
• ex: delay(2500); // delay of 2.5
sec.
• // NOTE: -> commands are CASE-
sensitive
Programming Concepts: Variables
Variable Scope
•Global
•---
•Function-level
Programming Concepts: Variable Types
• Variable Types:
8 bits 16 bits 32 bits
byte
char
int
unsigned int
long
unsigned long
float
Fading in and Fading Out (Analog or Digital?)
• A few pins on the Arduino allow for us to
modify the output to mimic an analog signal.
• This is done by a technique called:
• Pulse Width Modulation (PWM)
Concepts: Analog vs. Digital
•To create an analog signal, the microcontroller uses a
technique called PWM. By varying the duty cycle, we
can mimic an “average” analog voltage.
•Pulse Width Modulation (PWM)
•analogWrite(pin, val);
•
•pin – refers to the OUTPUT pin
(limited to pins 3, 5, 6, 9, 10, 11.) –
denoted by a ~ symbol
•val – 8 bit value (0 – 255).
• 0 => 0V | 255 => 5V
Introducing a new command…
Move one of your LED pins over to Pin
9
• In Arduino, open up:
• File  Examples  01.Basics  Fade
Fade - Code Review
Fade - Code Review
Arduino Programming Familiarization
Programming: Conditional Statements
if()
• void loop()
• {
• int buttonState =
digitalRead(5);
• if(buttonState == LOW)
• { // do something
• }
• else
• { // do something else
• }
• }
Programming: Conditional
Statements
if()
DIG
INPUT
Boolean Operators
<Boolean> Description
( ) == ( ) is equal?
( ) != ( ) is not equal?
( ) > ( ) greater than
( ) >= ( ) greater than or equal
( ) < ( ) less than
( ) <= ( ) less than or equal
analogRead()
• Arduino uses a 10-bit A/D Converter:
• this means that you get input values from 0
to 1023
• 0 V  0
• 5 V  1023
•Ex:
• int sensorValue = analogRead(A0);
Using Serial Communication
Method used to transfer data between two devices.
Arduino dedicates Digital I/O pin # 0 to
receiving and Digital I/O pin #1 to transmit.
Data passes between the computer and Arduino
through the USB cable. Data is transmitted as zeros
(‘0’) and ones (‘1’) sequentially.
Serial Monitor & analogRead()
Initializes the Serial
Communication
9600 baud data rate
prints data to serial bus
Serial Monitor & analogRead()
Opens up a Serial
Terminal Window
Additional Serial Communication
Sending a Message
void loop ( )
{
Serial.print(“Hands on “) ;
Serial.print(“Learning ”) ;
• Serial.println(“is Fun!!!”) ;
}
Arduino Programming Familiarization
Serial Communication:
Serial Debugging
void loop()
{
int xVar = 10;
Serial.print ( “Variable xVar is “ ) ;
Serial.println ( xVar ) ;
}
Serial Communication:
Serial Troubleshooting
void loop ( )
{
Serial.print (“Digital pin 9: “);
Serial.println (digitalRead(9));
}
Fritzing View of Breadboard Circuit
•What happens
when you break the
circuit?
•What if you
wanted to add
more than one
LED?
Now Let’s Play With
Arduino
Program 1
Blinking of LED
void loop() {
digitalWrite(13, HIGH); // turn the LED
on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED
off by making the voltage LOW
delay(1000); // wait for a second }
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}
Program 2
Serial Blinking of LEDs
Program 3
Fading of LED
Program 4
Analog Voltage Measurement
Program 5
Traffic Signal Controller

More Related Content

What's hot (20)

PPTX
Transistor Transistor Logic
surat murthy
 
PPT
Microprocessor ppt
swaminath kanhere
 
PPTX
Digital communication system
babak danyal
 
PPT
Verilog tutorial
Maryala Srinivas
 
DOCX
Security System using XOR & NOR
Fatima Qayyum
 
PPTX
Sequential cmos logic circuits
Sakshi Bhargava
 
PPTX
Vlsi design flow
Rajendra Kumar
 
PPT
Microwave engineering basics
AJAL A J
 
PPT
Microprocessor & microcontroller
Nitesh Kumar
 
PPTX
8051 Microcontroller PPT's By Er. Swapnil Kaware
Prof. Swapnil V. Kaware
 
PPTX
Introduction to Arduino
yeokm1
 
PPT
Broadband antennas
AJAL A J
 
PDF
ARM CORTEX M3 PPT
Gaurav Verma
 
PPTX
Complex Programmable Logic Device (CPLD) Architecture and Its Applications
elprocus
 
PPTX
Electronic components ppt
Deepjyoti Mahanta
 
PPTX
Introduction to Embedded System I: Chapter 2 (5th portion)
Moe Moe Myint
 
PDF
Chapter 5 introduction to VHDL
SSE_AndyLi
 
PDF
Arduino IDE
Mrunal Deshkar
 
PDF
verilog code for logic gates
Rakesh kumar jha
 
PPTX
Arduino
Jerin John
 
Transistor Transistor Logic
surat murthy
 
Microprocessor ppt
swaminath kanhere
 
Digital communication system
babak danyal
 
Verilog tutorial
Maryala Srinivas
 
Security System using XOR & NOR
Fatima Qayyum
 
Sequential cmos logic circuits
Sakshi Bhargava
 
Vlsi design flow
Rajendra Kumar
 
Microwave engineering basics
AJAL A J
 
Microprocessor & microcontroller
Nitesh Kumar
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
Prof. Swapnil V. Kaware
 
Introduction to Arduino
yeokm1
 
Broadband antennas
AJAL A J
 
ARM CORTEX M3 PPT
Gaurav Verma
 
Complex Programmable Logic Device (CPLD) Architecture and Its Applications
elprocus
 
Electronic components ppt
Deepjyoti Mahanta
 
Introduction to Embedded System I: Chapter 2 (5th portion)
Moe Moe Myint
 
Chapter 5 introduction to VHDL
SSE_AndyLi
 
Arduino IDE
Mrunal Deshkar
 
verilog code for logic gates
Rakesh kumar jha
 
Arduino
Jerin John
 

Similar to Arduino Programming Familiarization (20)

PPTX
Basic arduino components and more things about arduino
GeorgeTsak
 
PPT
Arduino_CSE ece ppt for working and principal of arduino.ppt
SAURABHKUMAR892774
 
PDF
Introduction to Arduino Programming
James Lewis
 
PPTX
Intro to Arduino.ppt
jonathan Dietz
 
PPTX
Intro_to_Arduino_-_v30.pptx
CephasMpandikaKalemb
 
PDF
ARUDINO UNO and RasberryPi with Python
Jayanthi Kannan MK
 
PDF
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
Jayanthi Kannan MK
 
PDF
introductiontoarduino-111120102058-phpapp02.pdf
HebaEng
 
PDF
Syed IoT - module 5
Syed Mustafa
 
PPTX
Audible Objects
Leif Bloomquist
 
PPTX
Fun with arduino
Ravikumar Tiwari
 
PPTX
Introduction to the Arduino
Wingston
 
PPTX
Introduction To Arduino-converted for s.pptx
rtnmsn
 
PDF
The IoT Academy IoT Training Arduino Part 3 programming
The IOT Academy
 
PPTX
Arduino board program for Mobile robotss
VSARAVANAKUMARHICETS
 
PPTX
embedded_in_Arduino_with_basic_embedded.pptx
acloudinfo2023
 
PPT
Arduino is an open-source electronics platform that has an easy-to-use physic...
ssuseraa8a48
 
PPTX
arduino introduction by Engr. Kennedy V. Rodriguez.pptx
KennedyRodriguez5
 
PPT
Fundamentals of programming Arduino-Wk2.ppt
ansariparveen06
 
Basic arduino components and more things about arduino
GeorgeTsak
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
SAURABHKUMAR892774
 
Introduction to Arduino Programming
James Lewis
 
Intro to Arduino.ppt
jonathan Dietz
 
Intro_to_Arduino_-_v30.pptx
CephasMpandikaKalemb
 
ARUDINO UNO and RasberryPi with Python
Jayanthi Kannan MK
 
4 IOT 18ISDE712 MODULE 4 IoT Physical Devices and End Point-Aurdino Uno.pdf
Jayanthi Kannan MK
 
introductiontoarduino-111120102058-phpapp02.pdf
HebaEng
 
Syed IoT - module 5
Syed Mustafa
 
Audible Objects
Leif Bloomquist
 
Fun with arduino
Ravikumar Tiwari
 
Introduction to the Arduino
Wingston
 
Introduction To Arduino-converted for s.pptx
rtnmsn
 
The IoT Academy IoT Training Arduino Part 3 programming
The IOT Academy
 
Arduino board program for Mobile robotss
VSARAVANAKUMARHICETS
 
embedded_in_Arduino_with_basic_embedded.pptx
acloudinfo2023
 
Arduino is an open-source electronics platform that has an easy-to-use physic...
ssuseraa8a48
 
arduino introduction by Engr. Kennedy V. Rodriguez.pptx
KennedyRodriguez5
 
Fundamentals of programming Arduino-Wk2.ppt
ansariparveen06
 
Ad

More from Amit Kumer Podder (13)

PPTX
Power Amplifier
Amit Kumer Podder
 
PPTX
Familiarization of electronic equipment
Amit Kumer Podder
 
PPTX
Transducer
Amit Kumer Podder
 
PPTX
Arduino Programming on Motor Control
Amit Kumer Podder
 
PPTX
8254 Programmable Interval Timer
Amit Kumer Podder
 
PPTX
Dot Matrix LED Interfacing using 8255 PPI
Amit Kumer Podder
 
PPTX
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
Amit Kumer Podder
 
PPTX
8086 Micro-processor and MDA 8086 Trainer Kit
Amit Kumer Podder
 
PPTX
Traffic Light Controller using 8255
Amit Kumer Podder
 
PPTX
8255 Programmble Peripheral Interface
Amit Kumer Podder
 
PPTX
8085 Microprocessor Programming and Instruction set
Amit Kumer Podder
 
PPTX
Micro-processor, Micro-controller and Peripherals
Amit Kumer Podder
 
PDF
Lecture on wire splicing and termination
Amit Kumer Podder
 
Power Amplifier
Amit Kumer Podder
 
Familiarization of electronic equipment
Amit Kumer Podder
 
Transducer
Amit Kumer Podder
 
Arduino Programming on Motor Control
Amit Kumer Podder
 
8254 Programmable Interval Timer
Amit Kumer Podder
 
Dot Matrix LED Interfacing using 8255 PPI
Amit Kumer Podder
 
8086 Assembly Language and Serial Monitor Operation of 8086 Trainer Kit
Amit Kumer Podder
 
8086 Micro-processor and MDA 8086 Trainer Kit
Amit Kumer Podder
 
Traffic Light Controller using 8255
Amit Kumer Podder
 
8255 Programmble Peripheral Interface
Amit Kumer Podder
 
8085 Microprocessor Programming and Instruction set
Amit Kumer Podder
 
Micro-processor, Micro-controller and Peripherals
Amit Kumer Podder
 
Lecture on wire splicing and termination
Amit Kumer Podder
 
Ad

Recently uploaded (20)

PPTX
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
PDF
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
PDF
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
 
PDF
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
PPTX
Final Major project a b c d e f g h i j k l m
bharathpsnab
 
PPTX
原版一样(EC Lille毕业证书)法国里尔中央理工学院毕业证补办
Taqyea
 
PPTX
UNIT 1 - INTRODUCTION TO AI and AI tools and basic concept
gokuld13012005
 
PPTX
Distribution reservoir and service storage pptx
dhanashree78
 
PPTX
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
PDF
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
PPTX
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
PPTX
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
PDF
AN EMPIRICAL STUDY ON THE USAGE OF SOCIAL MEDIA IN GERMAN B2C-ONLINE STORES
ijait
 
PDF
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
PPTX
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
 
PDF
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
PDF
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
PPTX
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
PPTX
Knowledge Representation : Semantic Networks
Amity University, Patna
 
PPTX
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Mechanical Design of shell and tube heat exchangers as per ASME Sec VIII Divi...
shahveer210504
 
Halide Perovskites’ Multifunctional Properties: Coordination Engineering, Coo...
TaameBerhe2
 
3rd International Conference on Machine Learning and IoT (MLIoT 2025)
ClaraZara1
 
methodology-driven-mbse-murphy-july-hsv-huntsville6680038572db67488e78ff00003...
henriqueltorres1
 
Final Major project a b c d e f g h i j k l m
bharathpsnab
 
原版一样(EC Lille毕业证书)法国里尔中央理工学院毕业证补办
Taqyea
 
UNIT 1 - INTRODUCTION TO AI and AI tools and basic concept
gokuld13012005
 
Distribution reservoir and service storage pptx
dhanashree78
 
2025 CGI Congres - Surviving agile v05.pptx
Derk-Jan de Grood
 
Reasons for the succes of MENARD PRESSUREMETER.pdf
majdiamz
 
Biosensors, BioDevices, Biomediccal.pptx
AsimovRiyaz
 
Introduction to Internal Combustion Engines - Types, Working and Camparison.pptx
UtkarshPatil98
 
AN EMPIRICAL STUDY ON THE USAGE OF SOCIAL MEDIA IN GERMAN B2C-ONLINE STORES
ijait
 
Water Industry Process Automation & Control Monthly July 2025
Water Industry Process Automation & Control
 
OCS353 DATA SCIENCE FUNDAMENTALS- Unit 1 Introduction to Data Science
A R SIVANESH M.E., (Ph.D)
 
mbse_An_Introduction_to_Arcadia_20150115.pdf
henriqueltorres1
 
WD2(I)-RFQ-GW-1415_ Shifting and Filling of Sand in the Pond at the WD5 Area_...
ShahadathHossain23
 
MODULE 03 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 
Knowledge Representation : Semantic Networks
Amity University, Patna
 
MODULE 04 - CLOUD COMPUTING AND SECURITY.pptx
Alvas Institute of Engineering and technology, Moodabidri
 

Arduino Programming Familiarization

  • 1. Department of Electrical and Electronic Engineering Khulna University of Engineering & Technology Khulna-9203 Course code : EE 3214 Sessional on Microprocessors, Micro-controllers and Peripherals Presented By Amit Kumer Podder Experiment No. 09
  • 2. (a) Introduction to Arduino board and Arduino IDE (b) Design and implementation of blinking LED, analog voltage measurement, string operation and traffic controller projects in Arduino environment Experiment Name
  • 3. Arduino is a prototype platform (open-source) based on an easy- to-use hardware and software. It consists of a circuit board, which can be programed (referred to as a microcontroller) and a ready-made software called Arduino IDE (Integrated Development Environment), which is used to write and upload the computer code to the physical board. Arduino
  • 4. Arduino & Arduino Compatible Boards
  • 8. Settings: Tools  Serial Port •Your computer communicates to the Arduino microcontroller via a serial port  through a USB-Serial adapter. •Check to make sure that the drivers are properly installed.
  • 9. •Next, double-check that the proper board is selected under the ToolsBoard menu. Settings: Tools  Board
  • 10. Arduino Integrated Development Environment (IDE) Two required functions / methods / routines: void setup() { // runs once } void loop() { // repeats }error & status messages
  • 11. Comments, Comments, Comments • Comments are for you – the programmer and your friends…or anyone else human that might read your code. • // this is for single line comments • // it’s good to put a description at the top and before anything ‘tricky’ • /* this is for multi-line comments • Like this… • And this…. • */
  • 13. digitalWrite() analogWrite() digitalRead() if() statements / Boolean analogRead() Serial communication This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States License. BIG6CONCEPTS
  • 14. Three commands to know… • pinMode(pin, INPUT/OUTPUT); • ex: pinMode(13, OUTPUT); • digitalWrite(pin, HIGH/LOW); • ex: digitalWrite(13, HIGH); • delay(time_ms); • ex: delay(2500); // delay of 2.5 sec. • // NOTE: -> commands are CASE- sensitive
  • 15. Programming Concepts: Variables Variable Scope •Global •--- •Function-level
  • 16. Programming Concepts: Variable Types • Variable Types: 8 bits 16 bits 32 bits byte char int unsigned int long unsigned long float
  • 17. Fading in and Fading Out (Analog or Digital?) • A few pins on the Arduino allow for us to modify the output to mimic an analog signal. • This is done by a technique called: • Pulse Width Modulation (PWM)
  • 18. Concepts: Analog vs. Digital •To create an analog signal, the microcontroller uses a technique called PWM. By varying the duty cycle, we can mimic an “average” analog voltage. •Pulse Width Modulation (PWM)
  • 19. •analogWrite(pin, val); • •pin – refers to the OUTPUT pin (limited to pins 3, 5, 6, 9, 10, 11.) – denoted by a ~ symbol •val – 8 bit value (0 – 255). • 0 => 0V | 255 => 5V Introducing a new command…
  • 20. Move one of your LED pins over to Pin 9 • In Arduino, open up: • File  Examples  01.Basics  Fade
  • 21. Fade - Code Review
  • 22. Fade - Code Review
  • 25. • void loop() • { • int buttonState = digitalRead(5); • if(buttonState == LOW) • { // do something • } • else • { // do something else • } • } Programming: Conditional Statements if() DIG INPUT
  • 26. Boolean Operators <Boolean> Description ( ) == ( ) is equal? ( ) != ( ) is not equal? ( ) > ( ) greater than ( ) >= ( ) greater than or equal ( ) < ( ) less than ( ) <= ( ) less than or equal
  • 27. analogRead() • Arduino uses a 10-bit A/D Converter: • this means that you get input values from 0 to 1023 • 0 V  0 • 5 V  1023 •Ex: • int sensorValue = analogRead(A0);
  • 28. Using Serial Communication Method used to transfer data between two devices. Arduino dedicates Digital I/O pin # 0 to receiving and Digital I/O pin #1 to transmit. Data passes between the computer and Arduino through the USB cable. Data is transmitted as zeros (‘0’) and ones (‘1’) sequentially.
  • 29. Serial Monitor & analogRead() Initializes the Serial Communication 9600 baud data rate prints data to serial bus
  • 30. Serial Monitor & analogRead() Opens up a Serial Terminal Window
  • 31. Additional Serial Communication Sending a Message void loop ( ) { Serial.print(“Hands on “) ; Serial.print(“Learning ”) ; • Serial.println(“is Fun!!!”) ; }
  • 33. Serial Communication: Serial Debugging void loop() { int xVar = 10; Serial.print ( “Variable xVar is “ ) ; Serial.println ( xVar ) ; }
  • 34. Serial Communication: Serial Troubleshooting void loop ( ) { Serial.print (“Digital pin 9: “); Serial.println (digitalRead(9)); }
  • 35. Fritzing View of Breadboard Circuit •What happens when you break the circuit? •What if you wanted to add more than one LED?
  • 36. Now Let’s Play With Arduino
  • 37. Program 1 Blinking of LED void loop() { digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(13, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second } void setup() { // initialize digital pin 13 as an output. pinMode(13, OUTPUT); }