Professional Documents
Culture Documents
Arduino Basics - 1
Arduino Basics - 1
arduino ( arrr-dween-oh )
1
Types of Arduino Boards
Arduino Nano
Arduino Mega
Arduino LilyPad
Arduino Uno
Arduino Mini Arduino Leonardo
2
Arduino Basics
arduino ( arrr-dween-oh )
4
Types of Arduino Boards
Arduino Nano
Arduino Mega
Arduino LilyPad
Arduino Uno
Arduino Mini Arduino Leonardo
5
Arduino Uno
Digital pins:
• 14 digital IO pins
• 6 are PWM pins (3, 5, 6, 9, 10, and 11).
Analog pins:
• 6 analog pins(A0, A1, A2, A3, A4, and
A5)
• Takes analog values as an input
6
7
Arduino IDE
VERIFY SERIAL
MONITOR
UPLOAD
NEW TAB
OPEN CODE GOES
SAVE HERE
BOARD &
SERIAL PORT
SELECTIONS
8
Basic Coding
structure
9
Basic Coding structure
setup() function
• Called when a sketch starts.
• To initialize variables, pin modes, start using libraries, etc.
• Will only run once, after each power-up or reset of the
Arduino board.
loop() function
• Loops consecutively.
• Code in the loop() section of the sketch is used to actively
control the Arduino board.
Commenting
• Any line that starts with two slashes (//) will not be read by
the compiler, so you can write anything you want after it.
10
pinMode()
• Instruction used to set the mode (INPUT or OUTPUT) in
which we are going to use a pin.
• Eg: pinMode (13, OUTPUT);
• ie. setting pin13 as output.
digitalWrite()
• Write a HIGH or a LOW value to a digital pin.
• Eg: digitalWrite (11, HIGH);
• ie. setting pin 11 to high.
11
digitalRead()
• Reads the value from a specified digital pin,
either HIGH or LOW
• Eg: int inPin=7;
val = digitalRead(inPin);
• ie. reads the value from inPin and assigns it to val.
delay()
• Pauses the program for the amount of time (in milliseconds)
specified as parameter.
• Eg: delay(1000);
• ie. waits for a second (1000 ms = 1 s)
12
Component List
Arduino Uno
USB cable
LED, RGB LED
LDR
POT(10k)
Resistors
Temp sensor LM-35
Motor Driver L293D, DC Motor
Connecting wire
13
LED Blink
14
Digital Read
15
Analog Read
16
LDR (Light Dependent Resistor)
17
LDR - Wiring
18
TEMP Sensor-LM35
19
20
DC Motor Drive – L293D
Motor Driver Circuit (L293D)
The L293 and L293D devices are quadruple high
current half-H drivers.
21
L293D Functional
Block Diagram
22
23
DC Motor Control
using L293D
24
RGB LED
Vcc
Green
Red Blue
25
“How much more Arduino can do
is only left to your imagination”
26
Thank you
27
Arduino Uno
Digital pins:
• 14 digital IO pins
• 6 are PWM pins (3, 5, 6, 9, 10, and 11).
Analog pins:
• 6 analog pins(A0, A1, A2, A3, A4, and
A5)
• Takes analog values as an input
28
29
Arduino IDE
VERIFY SERIAL
MONITOR
UPLOAD
NEW TAB
OPEN CODE GOES
SAVE HERE
BOARD &
SERIAL PORT
SELECTIONS
30
Basic Coding
structure
31
Basic Coding structure
setup() function
• Called when a sketch starts.
• To initialize variables, pin modes, start using libraries, etc.
• Will only run once, after each power-up or reset of the
Arduino board.
loop() function
• Loops consecutively.
• Code in the loop() section of the sketch is used to actively
control the Arduino board.
Commenting
• Any line that starts with two slashes (//) will not be read by
the compiler, so you can write anything you want after it.
32
pinMode()
• Instruction used to set the mode (INPUT or OUTPUT) in
which we are going to use a pin.
• Eg: pinMode (13, OUTPUT);
• ie. setting pin13 as output.
digitalWrite()
• Write a HIGH or a LOW value to a digital pin.
• Eg: digitalWrite (11, HIGH);
• ie. setting pin 11 to high.
33
digitalRead()
• Reads the value from a specified digital pin,
either HIGH or LOW
• Eg: int inPin=7;
val = digitalRead(inPin);
• ie. reads the value from inPin and assigns it to val.
delay()
• Pauses the program for the amount of time (in milliseconds)
specified as parameter.
• Eg: delay(1000);
• ie. waits for a second (1000 ms = 1 s)
34
Component List
Arduino Uno
USB cable
LED, RGB LED
LDR
POT(10k)
Resistors
Temp sensor LM-35
Motor Driver L293D, DC Motor
Connecting wire
35
LED Blink
36
Digital Read
37
Analog Read
38
LDR (Light Dependent Resistor)
39
LDR - Wiring
40
TEMP Sensor-LM35
41
42
DC Motor Drive – L293D
Motor Driver Circuit (L293D)
The L293 and L293D devices are quadruple high
current half-H drivers.
43
L293D Functional
Block Diagram
44
45
DC Motor Control
using L293D
46
RGB LED
Vcc
Green
Red Blue
47
“How much more Arduino can do
is only left to your imagination”
48
Thank you
49