Learn Arduino
TLE8
Creative Technologies
Which Arduino is Best for Your project
1. Arduino Uno
2. Arduino Mega
3. Arduino Nano
4. Arduino Due
5. Arduino Yun
6. Arduino MKR Zero
7. Arduino Ethernet Rev
Many variants of Arduino
Arduino Uno
• Arduino Uno is a famous and most used
Variant of Arduino, this board based on the
ATmega328p microcontroller.
• It has 14 digital input/output pins
• this board has 6 analog inputs,
• 16 MHZ crystal oscillator,
Arduino Uno Projects
Arduino
Temperature
Soil Moisture Detection with Automatic Detector Prototype
Water Pump Control
Arduino Mega
Arduino Mega 2560 is a microcontroller board based on the ATmega2560.
It has 53 digital input/output pins and 16 Analog pins.
Arduino Nano
The Arduino Nano is a small, complete, and
breadboard -friendly board based on the
ATmega328P released in 2008.
Arduino Due
The Arduino Due is the first
Arduino board based on a
32-bit ARM core
microcontroller. With 54
digital input/output pins, 12
analog inputs,
Arduino Yun
Arduino YÚN is the perfect
board to use when designing
connected devices and,
more in general, Internet of
Things projects. It combines
the power of Linux with the
ease of use of Arduino.
Arduino MKR Zero
Arduino MKR Zero is a
development board for music
makers! With an SD card holder and
dedicated SPI interfaces (SPI1), you
are able to play music files without
extra hardware.
Arduino Ethernet Rev 3
The Arduino Ethernet is a
microcontroller board based on the
ATmega328. It has 14 digital
input/output pins, 6 analog inputs,
a 16 MHz crystal oscillator, a RJ45
connection, a power jack, an ICSP
header, and a reset button.
It has an Ethernet connection and
a micro SD card reader
Tinkercard Activity
Arduino - Installation
Step 1 − First you must have your Arduino board (Arduino Uno Board)
and a USB cable.
Arduino - Installation
Step 2 − Download Arduino IDE Software.
Arduino - Installation
Step 3 − Power up your board.
Step 4 − Launch Arduino IDE.
Step 5 − Open your first project.
Arduino - Installation
Step 6 − Select your Arduino board.
Arduino - Installation
Step 7 − Select your serial port.
Arduino - Installation
Step 8 − Upload the program to your board.
Arduino - Installation
• Verify / Upload - compile and upload your code to your
Arduino Board .
• Select Board & Port - detected Arduino boards
automatically show up here, along with the port number .
• Sketchbook - here you will find all of your sketches locally
stored on your computer . Additionally, you can sync with
the Arduino Cloud, and also obtain your sketches from the
online environment .
• Boards Manager - browse through Arduino & third party
packages that can be installed .
• Library Manager - browse through thousands of
Arduino libraries, made by Arduino & its community .
• Debugger - test and debug programs in real time .
• Search - search for keywords in your code .
• Open Serial Monitor - opens the Serial Monitor tool,
as a new tab in the console .
• Serial Plotter is one of the tools in Arduino IDE .
Arduino can read the temperature, humidity or any
kind of sensor data, and send it to Serial Plotter .
1 Arduino IDE
23 4
1. Menu Bar
2. Verify
3. Upload
5 4.
5.
Serial Monitor
Area to write
code/sketch
6. Status
7. Message pane
6 8. selected board and
Comports
7
8
Arduino Program Structure
Three main parts of Arduino Program
• Structure
• Values
• Functions
Three main parts of Arduino Program
• Software structure consist of two main functions
Arduino Program Structure
Setup( ) function
• Executed right after power-up or reset.
• Executed only one time.
• Used to initialize variables, pin modes, start using
libraries.
Void means that it runs some code, then when it is done,
leaves the function and goes back to where it was called.
setup()
Arduino Program Structure
Baud Rate- the serial port is capable of transferring a maximum of 9600 bits per second.
The higher a baud rate goes, the faster data is sent/received, but there are limits to how
fast data can be transferred. You usually won't see speeds exceeding 115200 - that's fast
for most microcontrollers.
Three main parts of Arduino Program
Arduino Program Structure
• Software structure consist of two main functions
Loop( ) function
• Executed right after setup code.
• Executed repeatedly (infinitely).
• Used to do main task of application.
Arduino Program Structure
loop()
Arduino Program Structure
See the output result
function
Arduino Program Structure
A function is a block of code that has a name and a
block of statements that are executed when the
function is called.
type functionName (parameters)
{
statements;
}
*Parameters are the types of data the function take as an input. (pinMode, High)
function example: int delayVal ()
Arduino Program Structure
int delayVal ()
{
int v; // create temporary variable 'v'
v = analogRead(pot); // read potentiometer value
v /= 4; // converts 0 -1023 to 0 -255
return v; // return final value
}
{} curly braces/brackets
Arduino Program Structure
Curly braces (also referred to as just "braces" or "curly
brackets") define the beginning and end of function
blocks and statement blocks such as the void loop()
function and the for and if statements.
type function()
{
statements;
}
; semicolon
Arduino Program Structure
A semicolon must be used to end a statement and
separate elements of the program. A semicolon is also
used to separate elements in a for loop.
int x = 13; // declares variable 'x' as the integer 13
/*… */ multi-line or block comments
Arduino Program Structure
Block comments, or multi -line comments, are areas of
text ignored by the program and are used for large text
descriptions of code or comments that help others
understand parts of the program.
/* this is an enclosed block comment don’t forget
the closing comment - they have to be balanced! */
// Single line comments
Arduino Program Structure
Single line comments begin with // and end with the
next line of code. Like block comments, they are ignored
by the program and take no memory space.
// this is a single line comment
• Write a Simple
“Hello!” Sketch
ACTIVITY
• Write a Simple “Hello!” Sketch
ACTIVITY
ACTIVITY
[Link] a Simple
“Hello!” Sketch
3. Hello Messages
on New Lines
ACTIVITY
• Change [Link]("Hello!") to [Link]("Hello!").
• Upload the modified sketch and watch it print each "Hello!"
message on a new line.
4. Sample Output:
ACTIVITY
Group Name
Name
Bicol Regional Science High School
ACTIVITY