0% found this document useful (0 votes)
127 views

IOT Unit 4

The document outlines a video tutorial on programming the Arduino platform, focusing on its components, coding syntax, data types, and libraries. It covers essential topics such as decision-making statements, operators, and using Arduino for Internet of Things (IoT) applications. The tutorial aims to provide a comprehensive understanding of Arduino for both beginners and experienced users.

Uploaded by

EXAM CELL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views

IOT Unit 4

The document outlines a video tutorial on programming the Arduino platform, focusing on its components, coding syntax, data types, and libraries. It covers essential topics such as decision-making statements, operators, and using Arduino for Internet of Things (IoT) applications. The tutorial aims to provide a comprehensive understanding of Arduino for both beginners and experienced users.

Uploaded by

EXAM CELL
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

Engineering in One Video (EIOV) Watch video on EIOV

Engineering in One Video (EIOV) Watch video on EIOV

Internet of Things
Unit-4
Programming the Arduino
Engineering in One Video (EIOV) Watch video on EIOV

Topics to be covered...
Anatomy/Components of Arduino platform board
Arduino IDE
Arduino coding syntax
Variable and its scope
Data types
Function libraries
Arduino emulator
Decision making statement(if, else)
Operator
Additions in Arduino
Programming the Arduino for loT
Happy Ending!
Engineering in One Video (EIOV) Watch video on EIOV

Anatomy/Components
of Arduino platform
board
Engineering in One Video (EIOV) Watch video on EIOV

Anatomy/Components of Arduino board


Microcontroller: The "brain" of the Arduino board, which processes and executes code. For
most Arduino boards, this is an ATmega microcontroller that performs logical operations
and controls other components.

Digital I/O Pins: Pins that can be programmed as either input or output. They are used to
interface with digital sensors, LEDs, or other devices that require digital signals (high/low).

Analog Input Pins: These pins read varying voltage levels, allowing the Arduino to work
with analog sensors (e.g., temperature or light sensors) and convert those signals to digital
values.

Power Pins: The power pins provide voltage (typically 3.3V and 5V) and ground
connections, supplying power to sensors and other external devices.

ICSP (In-Circuit Serial Programming) Header: Allows you to program the microcontroller
directly and is useful for bootloading or low-level programming.
Engineering in One Video (EIOV) Watch video on EIOV

Anatomy/Components of Arduino board


USB Port: Used to connect the Arduino to a computer for programming and powering the
board. The USB interface is also used for serial communication, allowing the board to send
and receive data with a computer.

Voltage Regulator: Ensures the board receives a stable voltage, typically 5V, from external
sources, protecting components from voltage spikes.

Crystal Oscillator: Sets the clock speed of the microcontroller, ensuring it runs at a steady
pace (e.g., 16 MHz for most Arduinos), which is crucial for timing and synchronization.

Reset Button: This button resets the microcontroller, restarting the program from the
beginning. It’s useful for testing and debugging code.
Engineering in One Video (EIOV) Watch video on EIOV

Arduino IDE
Engineering in One Video (EIOV) Watch video on EIOV

Arduino IDE
The Arduino IDE (Integrated Development Environment) is the software platform used to
write, compile, and upload code to Arduino boards. It’s where you create the instructions
(code) that tell the Arduino what to do.

Steps to Set Up an Arduino Board


Download and Install the Arduino IDE
Connect the Arduino to Your Computer
Open the Arduino IDE
Select the Arduino Board Model
Select the Correct Port
Write or Open a Sketch (Code)
Verify and Upload the Code
Engineering in One Video (EIOV) Watch video on EIOV

Arduino coding syntax


EIOV

Arduino coding syntax


Engineering in One Video (EIOV) Watch video on EIOV

Variable and its scope


Engineering in One Video (EIOV) Watch video on
Engineering in One Video (EIOV) Watch video on EIOV

Variable and its scope


A variable is a named storage location in memory that holds a value, which can be modified
as the program runs.

Variables make it easy to store and manipulate data, like sensor readings or control states,
in your code.

int ledPin = 13;

Scope:
Global variables are declared outside functions and can be accessed anywhere in the
code.
Local variables are declared within functions (like setup() or loop()) and can only be
used within that function.
Engineering in One Video (EIOV) Watch video on EIOV

Variable and its scope


Data Types:
int (integer) for whole numbers, like 10.
float for decimal numbers, like 3.14.
char for single characters, like 'A'.
boolean for true/false values.
Engineering in One Video (EIOV) Watch video on EIOV

Data types
Engineering in One Video (EIOV) Watch video on EIOV

Data types
1. int (Integer)
Description: Holds whole numbers (no decimal points) from -32,768 to 32,767.
Uses: Ideal for counters, pin numbers, and sensor readings where you need integers.

2. float (Floating Point)


Description: Holds decimal values with single-precision (up to 6-7 significant digits).
Uses: Useful for measurements such as temperature, voltage, and distance.

3. boolean
Description: Stores true or false values, represented by 1 or 0 respectively.
Uses: Typically used in condition checks, toggling switches, on/off.

4. char (Character)
Description: Holds a single character, such as 'A' or '3', stored as an 8-bit ASCII value.
Uses: Useful for handling single characters or simple text elements.
Engineering in One Video (EIOV) Watch video on EIOV

Data types
5. String
Description: Allows for handling sequences of characters (text strings).
Uses: Useful for displaying messages, communicating with serial monitors, or passing text
data.

6. long
Description: Holds larger integer values than int, ranging from -2,147,483,648 to
2,147,483,647.
Uses: Useful when working with numbers larger than what int can store, such as long-
distance measurements or timer values.

7. unsigned int and unsigned long


unsigned int: Stores whole numbers from 0 to 65,535 (no negatives).
unsigned long: Stores whole numbers from 0 to 4,294,967,295, making it ideal for very
large positive values.
Engineering in One Video (EIOV) Watch video on EIOV

Function libraries
Engineering in One Video (EIOV) Watch video on EIOV

Function libraries
Libraries are collections of pre-written functions that simplify complex tasks and allow you
to use additional hardware or perform specialized actions in your code without writing
everything from scratch.
Libraries save time and make coding more efficient by providing reusable code that’s well-
documented and tested.

Key Points about Arduino Libraries


Purpose of Libraries: Libraries simplify complex tasks by providing pre-written code.

Use Libraries in Code: Include it beginning of your code with #include <libraryName.h>.

Library Structure: Libraries have organized files with functions for specific hardware.

Common Libraries: Frequently used libraries include Wire, SPI, and WiFi.

Installing Libraries: Libraries can be added through the Arduino Library Manager.
Engineering in One Video (EIOV) Watch video on EIOV

Function libraries
Engineering in One Video (EIOV) Watch video on EIOV

Arduino emulator
Engineering in One Video (EIOV) Watch video on
Engineering in One Video (EIOV) Watch video on EIOV

Arduino emulator
An Arduino emulator is a software tool that allows you to simulate an Arduino board on
your computer without needing physical hardware.

Emulators are helpful for testing and debugging code in a virtual environment, which can be
especially useful if you don’t have access to a specific Arduino board or component.

Key Points about Arduino Emulators:


Purpose of Emulators
Features
Popular Arduino Emulators: Tinkercad Circuits, Proteus Design Suite, SimulIDE
Benefits of Using an Emulator: Cost-effective, Time-saving, Risk-free
Engineering in One Video (EIOV) Watch video on EIOV

Arduino emulator
Engineering in One Video (EIOV) Watch video on EIOV

Decision making
statement(if, else)
Engineering in One Video (EIOV) Watch video on EIOV

Decision making statement(if, else)


Decision-making statements are used to control the flow of a program based on conditions.
These statements allow the Arduino to make decisions and execute certain parts of code
only when specific conditions are met.

1. if Statement 2. if-else Statement


Engineering in One Video (EIOV) Watch video on EIOV

Decision making statement(if, else)


3. if-else if-else Statement 4. switch-case Statement
Engineering in One Video (EIOV) Watch video on EIOV

Operator
Engineering in One Video (EIOV) Watch video on EIOV

Operator
An operator is a symbol that tells the compiler to perform a specific mathematical, relational,
or logical operation on one or more operands.
Operators are used to manipulate data and variables.
Engineering in One Video (EIOV) Watch video on EIOV

Additions in Arduino
Engineering in One Video (EIOV) Watch video on EIOV

Additions in Arduino
Engineering in One Video (EIOV) Watch video on EIOV

Programming the
Arduino for loT
Engineering in One Video (EIOV) Watch video on EIOV

Programming the Arduino for loT


Blink LED in Arduino
EIOV

Happy Ending!

You might also like