IOT Unit 4
IOT Unit 4
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
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
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.
Variables make it easy to store and manipulate data, like sensor readings or control states,
in your code.
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
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.
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.
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.
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.
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
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
Happy Ending!