0% found this document useful (0 votes)
41 views59 pages

Fiot - U4

This document provides an introduction to Python programming, highlighting its key features such as ease of learning, expressiveness, and support for multiple programming paradigms. It discusses Python's data types, including numbers, strings, lists, tuples, dictionaries, booleans, and sets, along with examples of their usage. Additionally, it emphasizes Python's portability, open-source nature, and the large community supporting its development.

Uploaded by

shalinigupta2040
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)
41 views59 pages

Fiot - U4

This document provides an introduction to Python programming, highlighting its key features such as ease of learning, expressiveness, and support for multiple programming paradigms. It discusses Python's data types, including numbers, strings, lists, tuples, dictionaries, booleans, and sets, along with examples of their usage. Additionally, it emphasizes Python's portability, open-source nature, and the large community supporting its development.

Uploaded by

shalinigupta2040
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/ 59

UNIT - 4

Introduction To Python Programming

Python Features
Python provides many useful features which make it popular and valuable from the
other programming languages. It supports object-oriented programming, procedural
programming approaches and provides dynamic memory allocation. We have listed
below a few essential features.

1) Easy to Learn and Use

Python is easy to learn as compared to other programming languages. Its syntax is


straightforward and much the same as the English language. There is no use of the
semicolon or curly-bracket, the indentation defines the code block. It is the
recommended programming language for beginners.

2) Expressive Language

Python can perform complex tasks using a few lines of code. A simple example, the
hello world program you simply type print("Hello World"). It will take only one line to
execute, while Java or C takes multiple lines.

3) Interpreted Language

Python is an interpreted language; it means the Python program is executed one line at
a time. The advantage of being interpreted language, it makes debugging easy and
portable.

Pause
Next
Unmute
Current TimeÂ

0:04

/
DurationÂ

18:10

Loaded: 3.67%
Â
Fullscreen

4) Cross-platform Language

Python can run equally on different platforms such as Windows, Linux, UNIX, and
Macintosh, etc. So, we can say that Python is a portable language. It enables
programmers to develop the software for several competing platforms by writing a
program only once.

5) Free and Open Source

Python is freely available for everyone. It is freely available on its official website
www.python.org. It has a large community across the world that is dedicatedly working
towards make new python modules and functions. Anyone can contribute to the Python
community. The open-source means, "Anyone can download its source code without
paying any penny."

6) Object-Oriented Language

Python supports object-oriented language and concepts of classes and objects come
into existence. It supports inheritance, polymorphism, and encapsulation, etc. The
object-oriented procedure helps to programmer to write reusable code and develop
applications in less code.

7) Extensible

It implies that other languages such as C/C++ can be used to compile the code and thus
it can be used further in our Python code. It converts the program into byte code, and
any platform can use that byte code.

8) Large Standard Library


It provides a vast range of libraries for the various fields such as machine learning, web
developer, and also for scripting. There are various machine learning libraries, such as
Tensor flow, Pandas, Numpy, Keras, and Pytorch, etc. Django, flask, and pyramids are the
popular frameworks for Python web development.

9) GUI Programming Support

A Graphical User Interface is used for developing Desktop applications. PyQT5, Tkinter,
Kivy are the libraries that are used for developing the web application.

10) Integrated

It can be easily integrated with languages like C, C++, and JAVA, etc. Python runs code
line by line like C, C++ Java. It makes it easy to debug the code.

11. Embeddable

The code of the other programming language can use in the Python source code. We
can use Python source code in another programming language as well. It can embed
other languages into our code.

12. Dynamic Memory Allocation

In Python, we don't need to specify the data type of the variable. When we assign some
value to the variable, it automatically allocates the memory to the variable at run time.
Suppose we are assigned integer value 15 to x, then we don't need to write int x = 15.
Just write x = 15.

Characteristics Of Python

Here are the characteristics of python:

​ Easy to learn:
​ Python is one of the easiest programming languages to learn. It has a simple syntax that is easy

to read and write.

​ Powerful:
​ Python is a powerful language that can be used for a wide variety of tasks, from web

development to data science.

​ Portable:
​ Python code can run on any platform that has a Python interpreter.

​ Free and open-source:


​ Python is free and open-source software, which means that it is free to use and distribute.

​ Large and active community:


​ Python has a large and active community of users and developers. This means that there is a lot

of support available for Python users.

Here are some of the most important features of Python:

​ Interpreted:
​ Python is an interpreted language, which means that the code is executed one line at a time. This

makes Python code very easy to debug.

​ Dynamically typed:
​ Python is a dynamically typed language, which means that the data type of a variable is not

declared. This makes Python code more flexible and easier to write.

​ Object-oriented:
​ Python is an object-oriented language, which means that code is organized into objects. This

makes Python code more reusable and maintainable.

​ High-level:
​ Python is a high-level language, which means that the code is written in a way that is close to

human language. This makes Python code more readable and easier to understand.

Python Data Types


Every value has a datatype, and variables can hold values. Python is a powerfully
composed language; consequently, we don't have to characterize the sort of variable
while announcing it. The interpreter binds the value implicitly to its type.

1. a = 5
We did not specify the type of the variable a, which has the value five from an integer.
The Python interpreter will automatically interpret the variable as an integer.

We can verify the type of the program-used variable thanks to Python. The type()
function in Python returns the type of the passed variable.

Consider the following illustration when defining and verifying the values of various data
types.

Backward Skip 10s


Play Video
Forward Skip 10s

1. a=10
2. b="Hi Python"
3. c = 10.5
4. print(type(a))
5. print(type(b))
6. print(type(c))

Output:

​ <type 'int'>
​ <type 'str'>
​ <type 'float'>

Standard data types


A variable can contain a variety of values. On the other hand, a person's id must be
stored as an integer, while their name must be stored as a string.
The storage method for each of the standard data types that Python provides is
specified by Python. The following is a list of the Python-defined data types.

1. Numbers

2. Sequence Type

3. Boolean

4. Set

5. Dictionary

The data types will be briefly discussed in this tutorial section. We will talk about every
single one of them exhaustively later in this instructional exercise.

Numbers
Numeric values are stored in numbers. The whole number, float, and complex qualities
have a place with a Python Numbers datatype. Python offers the type() function to
determine a variable's data type. The instance () capability is utilized to check whether
an item has a place with a specific class.

When a number is assigned to a variable, Python generates Number objects. For


instance,

1. a = 5
2. print("The type of a", type(a))
3.
4. b = 40.5
5. print("The type of b", type(b))
6.
7. c = 1+3j
8. print("The type of c", type(c))
9. print(" c is a complex number", isinstance(1+3j,complex))

Output:

​ The type of a <class 'int'>


​ The type of b <class 'float'>
​ The type of c <class 'complex'>
​ c is complex number: True

Python supports three kinds of numerical data.


○ Int: Whole number worth can be any length, like numbers 10, 2, 29, - 20, - 150, and
so on. An integer can be any length you want in Python. Its worth has a place
with int.

○ Float: Float stores drifting point numbers like 1.9, 9.902, 15.2, etc. It can be
accurate to within 15 decimal places.

○ Complex: An intricate number contains an arranged pair, i.e., x + iy, where x and y
signify the genuine and non-existent parts separately. The complex numbers like
2.14j, 2.0 + 2.3j, etc.

Sequence Type

String

The sequence of characters in the quotation marks can be used to describe the string. A
string can be defined in Python using single, double, or triple quotes.

String dealing with Python is a direct undertaking since Python gives worked-in
capabilities and administrators to perform tasks in the string.

When dealing with strings, the operation "hello"+" python" returns "hello python," and the
operator + is used to combine two strings.

Because the operation "Python" *2 returns "Python," the operator * is referred to as a


repetition operator.

The Python string is demonstrated in the following example.

Example - 1

1. str = "string using double quotes"


2. print(str)
3. s = '''''A multiline
4. string'''
5. print(s)

Output:

​ string using double quotes


​ A multiline
​ string

Look at the following illustration of string handling.

Example - 2

1. str1 = 'hello javatpoint' #string str1


2. str2 = ' how are you' #string str2
3. print (str1[0:2]) #printing first two character using slice operator
4. print (str1[4]) #printing 4th character of the string
5. print (str1*2) #printing the string twice
6. print (str1 + str2) #printing the concatenation of str1 and str2

Output:

​ he
​ o
​ hello javatpointhello javatpoint
​ hello javatpoint how are you

List
Lists in Python are like arrays in C, but lists can contain data of different types. The
things put away in the rundown are isolated with a comma (,) and encased inside
square sections [].

To gain access to the list's data, we can use slice [:] operators. Like how they worked
with strings, the list is handled by the concatenation operator (+) and the repetition
operator (*).

Look at the following example.

Example:

1. list1 = [1, "hi", "Python", 2]


2. #Checking type of given list
3. print(type(list1))
4.
5. #Printing the list1
6. print (list1)
7.
8. # List slicing
9. print (list1[3:])
10.
11. # List slicing
12. print (list1[0:2])
13.
14. # List Concatenation using + operator
15. print (list1 + list1)
16.
17. # List repetation using * operator
18. print (list1 * 3)
Output:

​ [1, 'hi', 'Python', 2]


​ [2]
​ [1, 'hi']
​ [1, 'hi', 'Python', 2, 1, 'hi', 'Python', 2]
​ [1, 'hi', 'Python', 2, 1, 'hi', 'Python', 2, 1, 'hi', 'Python', 2]

Tuple

In many ways, a tuple is like a list. Tuples, like lists, also contain a collection of items
from various data types. A parenthetical space () separates the tuple's components
from one another.

Because we cannot alter the size or value of the items in a tuple, it is a read-only data
structure.

Let's look at a straightforward tuple in action.

Example:

1. tup = ("hi", "Python", 2)


2. # Checking type of tup
3. print (type(tup))
4.
5. #Printing the tuple
6. print (tup)
7.
8. # Tuple slicing
9. print (tup[1:])
10. print (tup[0:1])
11.
12. # Tuple concatenation using + operator
13. print (tup + tup)
14.
15. # Tuple repatation using * operator
16. print (tup * 3)
17.
18. # Adding value to tup. It will throw an error.
19. t[2] = "hi"

Output:

​ <class 'tuple'>
​ ('hi', 'Python', 2)
​ ('Python', 2)
​ ('hi',)
​ ('hi', 'Python', 2, 'hi', 'Python', 2)
​ ('hi', 'Python', 2, 'hi', 'Python', 2, 'hi', 'Python', 2)

​ Traceback (most recent call last):


​ File "main.py", line 14, in <module>
​ t[2] = "hi";
​ TypeError: 'tuple' object does not support item assignment

Dictionary
A dictionary is a key-value pair set arranged in any order. It stores a specific value for
each key, like an associative array or a hash table. Value is any Python object, while the
key can hold any primitive data type.

The comma (,) and the curly braces are used to separate the items in the dictionary.

Look at the following example.

1. d = {1:'Jimmy', 2:'Alex', 3:'john', 4:'mike'}


2.
3. # Printing dictionary
4. print (d)
5.
6. # Accesing value using keys
7. print("1st name is "+d[1])
8. print("2nd name is "+ d[4])
9.
10. print (d.keys())
11. print (d.values())

Output:

​ 1st name is Jimmy


​ 2nd name is mike
​ {1: 'Jimmy', 2: 'Alex', 3: 'john', 4: 'mike'}
​ dict_keys([1, 2, 3, 4])
​ dict_values(['Jimmy', 'Alex', 'john', 'mike'])

Boolean
True and False are the two default values for the Boolean type. These qualities are
utilized to decide the given assertion valid or misleading. The class book indicates this.
False can be represented by the 0 or the letter "F," while true can be represented by any
value that is not zero.

Look at the following example.

1. # Python program to check the boolean type


2. print(type(True))
3. print(type(False))
4. print(false)

Output:

​ <class 'bool'>
​ <class 'bool'>
​ NameError: name 'false' is not defined

Set

The data type's unordered collection is Python Set. It is iterable, mutable(can change
after creation), and has remarkable components. The elements of a set have no set
order; It might return the element's altered sequence. Either a sequence of elements is
passed through the curly braces and separated by a comma to create the set or the
built-in function set() is used to create the set. It can contain different kinds of values.

Look at the following example.

1. # Creating Empty set


2. set1 = set()
3.
4. set2 = {'James', 2, 3,'Python'}
5.
6. #Printing Set value
7. print(set2)
8.
9. # Adding element to the set
10.
11. set2.add(10)
12. print(set2)
13.
14. #Removing element from the set
15. set2.remove(2)
16. print(set2)

Output:

​ {3, 'Python', 'James', 2}


​ {'Python', 'James', 3, 2, 10}

{'Python', 'James', 3, 10}

Python Operators

Introduction:
In this article, we are discussing Python Operators. The operator is a symbol that
performs a specific operation between two operands, according to one definition.
Operators serve as the foundation upon which logic is constructed in a program in a
particular programming language. In every programming language, some operators
perform several tasks. Same as other languages, Python also has some operators, and
these are given below -

○ Arithmetic operators

○ Comparison operators

○ Assignment Operators

○ Logical Operators

○ Bitwise Operators

○ Membership Operators

○ Identity Operators

○ Arithmetic Operators

Arithmetic Operators
Arithmetic operators used between two operands for a particular operation. There are
many arithmetic operators. It includes the exponent (**) operator as well as the +
(addition), - (subtraction), * (multiplication), / (divide), % (reminder), and // (floor
division) operators.

Consider the following table for a detailed explanation of arithmetic operators.

Operator Description

+ (Addition) It is used to add two operands. For example, if a = 10, b = 10 => a+b =

20
- It is used to subtract the second operand from the first operand. If the

(Subtracti first operand is less than the second operand, the value results

on) negative. For example, if a = 20, b = 5 => a - b = 15

/ (divide) It returns the quotient after dividing the first operand by the second

operand. For example, if a = 20, b = 10 => a/b = 2.0

* It is used to multiply one operand with the other. For example, if a =

(Multiplica 20, b = 4 => a * b = 80

tion)

% (reminder) It returns the reminder after dividing the first operand by the second

operand. For example, if a = 20, b = 10 => a%b = 0

** (Exponent) As it calculates the first operand's power to the second operand, it is

an exponent operator.

// (Floor It provides the quotient's floor value, which is obtained by dividing the

division) two operands.

Program Code:
Now we give code examples of arithmetic operators in Python. The code is given below
-

1. a = 32 # Initialize the value of a


2. b = 6 # Initialize the value of b
3. print('Addition of two numbers:',a+b)
4. print('Subtraction of two numbers:',a-b)
5. print('Multiplication of two numbers:',a*b)
6. print('Division of two numbers:',a/b)
7. print('Reminder of two numbers:',a%b)
8. print('Exponent of two numbers:',a**b)
9. print('Floor division of two numbers:',a//b)

Output:

Now we compile the above code in Python, and after successful compilation, we run it.
Then the output is given below -

​ Addition of two numbers: 38


​ Subtraction of two numbers: 26
​ Multiplication of two numbers: 192
​ Division of two numbers: 5.333333333333333
​ Reminder of two numbers: 2
​ Exponent of two numbers: 1073741824
​ Floor division of two numbers: 5

Comparison operator
Comparison operators mainly use for comparison purposes. Comparison operators
compare the values of the two operands and return a true or false Boolean value in
accordance. The example of comparison operators are ==, !=, <=, >=, >, <. In the below
table, we explain the works of the operators.

Operat Description
or

== If the value of two operands is equal, then the condition becomes true.

!= If the value of two operands is not equal, then the condition becomes true.

<= The condition is met if the first operand is smaller than or equal to the

second operand.

>= The condition is met if the first operand is greater than or equal to the

second operand.

> If the first operand is greater than the second operand, then the condition

becomes true.
< If the first operand is less than the second operand, then the condition

becomes true.

Program Code:

Now we give code examples of Comparison operators in Python. The code is given
below -

1. a = 32 # Initialize the value of a


2. b = 6 # Initialize the value of b
3. print('Two numbers are equal or not:',a==b)
4. print('Two numbers are not equal or not:',a!=b)
5. print('a is less than or equal to b:',a<=b)
6. print('a is greater than or equal to b:',a>=b)
7. print('a is greater b:',a>b)
8. print('a is less than b:',a<b)

Output:

Now we compile the above code in Python, and after successful compilation, we run it.
Then the output is given below -

​ Two numbers are equal or not: False


​ Two numbers are not equal or not: True
​ a is less than or equal to b: False
​ a is greater than or equal to b: True
​ a is greater b: True
​ a is less than b: False
Assignment Operators
Using the assignment operators, the right expression's value is assigned to the left
operand. There are some examples of assignment operators like =, +=, -=, *=, %=, **=,
//=. In the below table, we explain the works of the operators.

Operat Description
or

= It assigns the value of the right expression to the left operand.

+= By multiplying the value of the right operand by the value of the left

operand, the left operand receives a changed value. For example, if a =

10, b = 20 => a+ = b will be equal to a = a+ b and therefore, a = 30.

-= It decreases the value of the left operand by the value of the right operand

and assigns the modified value back to left operand. For example, if a =

20, b = 10 => a- = b will be equal to a = a- b and therefore, a = 10.

*= It multiplies the value of the left operand by the value of the right operand

and assigns the modified value back to then the left operand. For
example, if a = 10, b = 20 => a* = b will be equal to a = a* b and therefore,

a = 200.

%= It divides the value of the left operand by the value of the right operand and

assigns the reminder back to the left operand. For example, if a = 20, b =

10 => a % = b will be equal to a = a % b and therefore, a = 0.

**= a**=b will be equal to a=a**b, for example, if a = 4, b =2, a**=b will assign

4**2 = 16 to a.

//= A//=b will be equal to a = a// b, for example, if a = 4, b = 3, a//=b will assign

4//3 = 1 to a.

Program Code:

Now we give code examples of Assignment operators in Python. The code is given
below -

1. a = 32 # Initialize the value of a


2. b = 6 # Initialize the value of b
3. print('a=b:', a==b)
4. print('a+=b:', a+b)
5. print('a-=b:', a-b)
6. print('a*=b:', a*b)
7. print('a%=b:', a%b)
8. print('a**=b:', a**b)
9. print('a//=b:', a//b)

Output:

Now we compile the above code in Python, and after successful compilation, we run it.
Then the output is given below -

​ a=b: False
​ a+=b: 38
​ a-=b: 26
​ a*=b: 192
​ a%=b: 2
​ a**=b: 1073741824
​ a//=b: 5

Bitwise Operators
The two operands' values are processed bit by bit by the bitwise operators. The
examples of Bitwise operators are bitwise OR (|), bitwise AND (&), bitwise XOR (^),
negation (~), Left shift (<<), and Right shift (>>). Consider the case below.

For example,

1. if a = 7
2. b=6
3. then, binary (a) = 0111
4. binary (b) = 0110
5.
6. hence, a & b = 0011
7. a | b = 0111
8. a ^ b = 0100
9. ~ a = 1000
10. Let, Binary of x = 0101
11. Binary of y = 1000
12. Bitwise OR = 1101
13. 8 4 2 1
14. 1 1 0 1 = 8 + 4 + 1 = 13
15.
16. Bitwise AND = 0000
17. 0000 = 0
18.
19. Bitwise XOR = 1101
20. 8 4 2 1
21. 1 1 0 1 = 8 + 4 + 1 = 13
22. Negation of x = ~x = (-x) - 1 = (-5) - 1 = -6
23. ~x = -6

In the below table, we are explaining the works of the bitwise operators.

Operator Description

& (binary A 1 is copied to the result if both bits in two operands at the same

and) location are 1. If not, 0 is copied.


| (binary or) The resulting bit will be 0 if both the bits are zero; otherwise, the resulting

bit will be 1.

^ (binary If the two bits are different, the outcome bit will be 1, else it will be 0.

xor)

~ The operand's bits are calculated as their negations, so if one bit is 0, the

(negatio next bit will be 1, and vice versa.

n)

<< (left The number of bits in the right operand is multiplied by the leftward shift

shift) of the value of the left operand.

>> (right The left operand is moved right by the number of bits present in the right

shift) operand.

Program Code:

Now we give code examples of Bitwise operators in Python. The code is given below -

1. a = 5 # initialize the value of a


2. b = 6 # initialize the value of b
3. print('a&b:', a&b)
4. print('a|b:', a|b)
5. print('a^b:', a^b)
6. print('~a:', ~a)
7. print('a<<b:', a<<b)
8. print('a>>b:', a>>b)

Output:

Now we compile the above code in Python, and after successful compilation, we run it.
Then the output is given below -

​ a&b: 4
​ a|b: 7
​ a^b: 3
​ ~a: -6
​ a<>b: 0

Logical Operators
The assessment of expressions to make decisions typically uses logical operators. The
examples of logical operators are and, or, and not. In the case of logical AND, if the first
one is 0, it does not depend upon the second one. In the case of logical OR, if the first
one is 1, it does not depend on the second one. Python supports the following logical
operators. In the below table, we explain the works of the logical operators.

Operat Description
or
and The condition will also be true if the expression is true. If the two

expressions a and b are the same, then a and b must both be true.

or The condition will be true if one of the phrases is true. If a and b are the two

expressions, then an or b must be true if and is true and b is false.

not If an expression a is true, then not (a) will be false and vice versa.

Program Code:

Now we give code examples of arithmetic operators in Python. The code is given below
-

1. a = 5 # initialize the value of a


2. print(Is this statement true?:',a > 3 and a < 5)
3. print('Any one statement is true?:',a > 3 or a < 5)
4. print('Each statement is true then return False and vice-versa:',(not(a > 3 and a <
5)))

Output:

Now we give code examples of Bitwise operators in Python. The code is given below -

​ Is this statement true?: False


​ Any one statement is true?: True
​ Each statement is true then return False and vice-versa: True
Membership Operators
The membership of a value inside a Python data structure can be verified using Python
membership operators. The result is true if the value is in the data structure; otherwise,
it returns false.

Operat Description
or

in If the first operand cannot be found in the second operand, it is evaluated to

be true (list, tuple, or dictionary).

not in If the first operand is not present in the second operand, the evaluation is

true (list, tuple, or dictionary).

Program Code:

Now we give code examples of Membership operators in Python. The code is given
below -

1. x = ["Rose", "Lotus"]
2. print(' Is value Present?', "Rose" in x)
3. print(' Is value not Present?', "Riya" not in x)

Output:
Now we compile the above code in Python, and after successful compilation, we run it.
Then the output is given below -

​ Is value Present? True


​ Is value not Present? True

Identity Operators

Operat Description
or

is If the references on both sides point to the same object, it is determined to

be true.

is not If the references on both sides do not point at the same object, it is

determined to be true.

Program Code:

Now we give code examples of Identity operators in Python. The code is given below -

1. a = ["Rose", "Lotus"]
2. b = ["Rose", "Lotus"]
3. c = a
4. print(a is c)
5. print(a is not c)
6. print(a is b)
7. print(a is not b)
8. print(a == b)
9. print(a != b)

Output:

Now we compile the above code in python, and after successful compilation, we run it.
Then the output is given below -

​ True
​ False
​ False
​ True
​ True
​ False

Operator Precedence
The order in which the operators are examined is crucial to understand since it tells us
which operator needs to be considered first. Below is a list of the Python operators'
precedence tables.

Operator Description
** Overall other operators employed in the expression, the exponent

operator is given precedence.

~+- the minus, unary plus, and negation.

* / % // the division of the floor, the modules, the division, and the

multiplication.

+- Binary plus, and minus

>> << Left shift. and right shift

& Binary and.

^| Binary xor, and or

<= < > >= Comparison operators (less than, less than equal to, greater than,

greater then equal to).


<> == != Equality operators.

= %= /= //= -= Assignment operators

+=

*= **=

is is not Identity operators

in not in Membership operators

not or and Logical operators

Conclusion:
So, in this article, we are discussing all the Python Operators. We briefly discuss how
they work and share the program code using each operator in Python.

​ Introduction To Raspberry Pi

The Raspberry Pi is a credit card-sized single-board computer, making it an


exciting and accessible entry point into the world of technology and
programming. Here's a quick introduction to what it is and what it can do:
What is it?

● A small, low-cost computer that plugs into a monitor and uses a keyboard
and mouse, similar to a desktop PC.
● Developed by the Raspberry Pi Foundation to promote computer science
education and maker culture.
● Runs on a Linux-based operating system called Raspberry Pi OS.

What can it do?

● Basic computing tasks: Browse the web, watch videos, use office
applications, manage files.
● Programming and learning: Learn Python, Java, Scratch, and other
languages. Build simple games, websites, and applications.
● Electronics and tinkering: Connect sensors, LEDs, buttons, motors, and
other electronic components to create robots, weather stations, home
automation systems, and more.
● Media center: Stream movies and music, run Kodi or Plex for a personal
media library.
● Retro gaming: Emulate classic arcade and console games from the 8-bit
and 16-bit era.

Key features:

● Affordable: Prices start around $35, making it an accessible platform for


experimentation.
● Portable: Small size and low power consumption make it easy to take on
the go.
● Versatile: Wide range of capabilities and endless possibilities for projects.
● Open-source: Supportive community and vast online resources for
learning and troubleshooting.
Getting started:

● Several Raspberry Pi models are available, each with different specs and
capabilities. Choose one that suits your needs and budget.
● You'll also need basic peripherals like a power supply, microSD card,
monitor, keyboard, and mouse.
● Download and install Raspberry Pi OS onto the microSD card.
● Connect everything up and follow the setup instructions.

Resources:

● Raspberry Pi Foundation website: https://www.raspberrypi.org/


● Official Raspberry Pi projects: https://projects.raspberrypi.org/
● Get started guide:
https://projects.raspberrypi.org/en/pathways/getting-started-with-raspberry
-pi
● Tutorials and documentation: https://www.raspberrypi.com/documentation/

Raspberry Pi With Basic Periphals

The Raspberry Pi is an excellent platform for anyone curious about technology,


programming, or DIY electronics. It's a fun, affordable, and educational tool that
opens up a world of possibilities.

he Raspberry Pi is a versatile single-board computer that can be interfaced with a


variety of peripherals to expand its capabilities. Here are some of the most
common ways to interface a Raspberry Pi with peripherals:

● General-purpose input/output (GPIO) pins: The Raspberry Pi has GPIO pins


that can be used to control LEDs, buttons, sensors, and other devices.
These pins can be configured as inputs or outputs, and they can be used to
read digital data or generate digital signals.

Opens in a new window

www.raspberrypi.com

Raspberry Pi GPIO pins

● I2C: I2C is a serial communication protocol that allows you to connect


multiple devices to a single pair of wires. The Raspberry Pi has an I2C bus
that can be used to connect devices such as temperature sensors,
accelerometers, and real-time clocks.

Opens in a new window

www.electronicwings.com
Raspberry Pi I2C

● SPI: SPI is another serial communication protocol that is often used for
high-speed communication with devices such as display controllers and
SD cards. The Raspberry Pi has an SPI bus that can be used to connect
these types of devices.

Opens in a new window

electronics.stackexchange.com

Raspberry Pi SPI

● UART: UART is a serial communication protocol that is often used for


communicating with devices such as GPS modules and Bluetooth
adapters. The Raspberry Pi has a UART port that can be used to connect
these types of devices.
Opens in a new window

www.electronicwings.com

Raspberry Pi UART

● USB: USB is a popular interface that can be used to connect a wide variety
of devices to the Raspberry Pi, such as keyboards, mice, webcams, and
external hard drives.

Opens in a new window

www.amazon.de

Raspberry Pi USB
● HDMI: HDMI is a high-definition multimedia interface that can be used to
connect the Raspberry Pi to a TV or monitor.

Opens in a new window

thepihut.com

Raspberry Pi HDMI

The specific interface you will use to connect a peripheral to your Raspberry Pi
will depend on the type of peripheral and its capabilities. Some peripherals may
require additional hardware, such as a breadboard or a voltage regulator, in order
to be used with the Raspberry Pi.

Here are some tips for interfacing peripherals with the Raspberry Pi:

● Read the documentation for the peripheral you are using. This will provide
you with information on how to connect the peripheral to the Raspberry Pi
and how to use it with your code.
● Start with a simple project. Once you have successfully interfaced a simple
peripheral with the Raspberry Pi, you can move on to more complex
projects.
● There are many resources available online to help you get started with
interfacing peripherals with the Raspberry Pi. These resources include
tutorials, forums, and communities.

Implementation Of IoT With Raspberry Pi

What is the Raspberry Pi?

The Raspberry Pi is a credit-card sized computer that can be used for a variety of
purposes, including IoT projects. It is relatively inexpensive and easy to use,
making it a popular choice for beginners.

What is the IoT?

The IoT is a network of physical devices that are embedded with sensors,
software, and actuators that allow them to collect and exchange data. This data
can be used to monitor and control the devices remotely.

How can the Raspberry Pi be used for IoT?

The Raspberry Pi can be used for IoT in a number of ways, such as:

● Collecting data from sensors: The Raspberry Pi can be used to collect data
from a variety of sensors, such as temperature sensors, humidity sensors,
and motion sensors. This data can be used to monitor the environment,
track assets, or even control other devices.
● Controlling devices: The Raspberry Pi can be used to control devices, such
as lights, switches, and motors. This can be done through the Raspberry
Pi's GPIO pins or through a variety of add-on boards.
● Connecting to the cloud: The Raspberry Pi can be connected to the cloud,
which allows you to store and access your data from anywhere in the
world. You can also use cloud services to control your devices and to
create custom applications.

What do you need to get started?

In order to get started with IoT using a Raspberry Pi, you will need the following:

● A Raspberry Pi
● A power supply
● An SD card with an operating system installed (such as Raspbian)
● Sensors
● Actuators (optional)
● Breadboard and jumper wires (optional)

How to get started

Once you have all of the necessary components, you can follow these steps to
get started:

1. Install the operating system on the SD card.


2. Connect the Raspberry Pi to the power supply and to a monitor or TV.
3. Install the necessary software.
4. Connect your sensors and actuators to the Raspberry Pi.
5. Write code to control your devices and collect data from your sensors.
6. Connect your Raspberry Pi to the cloud (optional).

Here are some examples of IoT projects that you can build with a Raspberry Pi:

● A smart home system that can control lights, thermostats, and other
devices.
● A weather station that can monitor temperature, humidity, and other
weather conditions.
● A plant watering system that can automatically water your plants based on
the soil moisture level.
● A security system that can send you alerts when motion is detected.

The possibilities are endless! With a little creativity, you can use a Raspberry Pi to
build just about any kind of IoT project you can imagine.
Here are some additional resources that you may find helpful:

● https://projects.raspberrypi.org/
● https://www.tutorialspoint.com/raspberry_pi/index.htm
● https://www.raspberrypi.com/software/operating-systems/

Explain the program for blinking of LED using Arduino IDE.

Here's a comprehensive explanation of the LED blinking program in Arduino IDE,


incorporating images:

1. Hardware Setup:

Components:

● Arduino board (e.g., Uno, Nano)


● LED (any color)
● Resistor (220 ohms or similar)
● Breadboard (optional, for easier connections)
● Jumper wires

Circuit Diagram:

Connections:

1. Connect the long leg (anode) of the LED to pin 13 on the Arduino board.
2. Connect the short leg (cathode) of the LED to a resistor.
3. Connect the other end of the resistor to GND (ground) on the Arduino board.

2. Software Setup:

1. Open Arduino IDE:


2. Create a new sketch: File > New.
3. Write the code:

C++
void setup() {
// Initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}

void loop() {
// Turn the LED on (HIGH is the voltage level)
digitalWrite(13, HIGH);
// Wait for 1000 milliseconds (1 second)
delay(1000);
// Turn the LED off (LOW is the voltage level)
digitalWrite(13, LOW);
// Wait for 1000 milliseconds (1 second)
delay(1000);
}

4. Compile the code: Verify (check for errors).


5. Upload the code: Select the correct board and port, then click "Upload."

3. Code Explanation:

● setup() function: Runs once at the beginning.


○ pinMode(13, OUTPUT): Sets pin 13 as an output, able to send voltage to control
the LED.
● loop() function: Runs repeatedly after setup.
○ digitalWrite(13, HIGH): Sends 5 volts to pin 13, turning the LED on.
○ delay(1000): Pauses the program for 1000 milliseconds (1 second).
○ digitalWrite(13, LOW): Sends 0 volts to pin 13, turning the LED off.
○ delay(1000): Pauses the program for another second.

4. Troubleshooting:

● If the LED doesn't blink, double-check your connections and code.


● Ensure the resistor is connected correctly to protect the LED.
● If using a different pin, change the pin number in the code.

5. Customization:

● Experiment with different delay values to change the blinking speed.


● Use multiple LEDs and pins to create more complex patterns.

Write the program to monitor temperature and display using LCD in


Arduino IDE.

Here's the program to monitor temperature and display it on an LCD using Arduino
IDE:

1. Hardware Setup:

● Arduino board: Any Arduino board (Uno, Nano, Mega, etc.) will work.
● Temperature sensor: Choose a suitable sensor like LM35, TMP36, DHT11, or
DHT22.
● LCD module: A 16x2 LCD module with an I2C backpack is recommended for
simplicity.
● Jumper wires: To connect the components.
● Breadboard (optional): To simplify prototyping.

2. Circuit Connections:

For a DHT sensor:

● Connect DHT sensor's VCC pin to Arduino's 5V pin.


● Connect DHT sensor's GND pin to Arduino's GND pin.
● Connect DHT sensor's data pin to a digital pin on Arduino (e.g., pin 4).

For an LM35 or TMP36 sensor:

● Connect sensor's VCC pin to Arduino's 5V pin.


● Connect sensor's GND pin to Arduino's GND pin.
● Connect sensor's output pin to an analog pin on Arduino (e.g., A0).

For an I2C LCD module:

● Connect LCD's VCC pin to Arduino's 5V pin.


● Connect LCD's GND pin to Arduino's GND pin.
● Connect LCD's SDA pin to Arduino's SDA pin (usually A4).
● Connect LCD's SCL pin to Arduino's SCL pin (usually A5).

Refer to the sensor and LCD module's datasheets for detailed pinouts.

3. Arduino Code:

Arduino
#include <LiquidCrystal_I2C.h> // Include LCD library
#include <DHT.h> // Include DHT sensor library (if
using DHT)

// Define pins and variables


LiquidCrystal_I2C lcd(0x27, 16, 2); // Set LCD address and
dimensions
#define DHTPIN 4 // DHT sensor pin (if using DHT)
#define DHTTYPE DHT11 // DHT sensor type (if using DHT)

DHT dht(DHTPIN, DHTTYPE); // Initialize DHT sensor (if


using DHT)
void setup() {
lcd.begin(); // Initialize LCD
lcd.backlight(); // Turn on LCD backlight
dht.begin(); // Initialize DHT sensor (if
using DHT)
}

void loop() {
float temperature = 0.0;

// Read temperature based on sensor type


if (dht.read()) { // If using DHT sensor
temperature = dht.readTemperature();
} else { // If using LM35 or TMP36 sensor
temperature = analogRead(A0) * (5.0 / 1024.0) * 100;
}

// Display temperature on LCD


lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Temperature: ");
lcd.print(temperature);
lcd.print(" C");
delay(1000); // Update every second
}

4. Upload Code and Run:

● Connect Arduino to your computer.


● Open Arduino IDE and paste the code.
● Select the correct board and port.
● Install any necessary libraries (e.g., DHT library, LiquidCrystal_I2C library).
● Upload the code to Arduino.
● The LCD should display the temperature.

Sketch and explain the pin diagram of Aurdino.

Arduino Pin Configuration – Complete Guide


2021
Arduino 0 comments 15096 Views Tuesday, July 14, 2020
This guide includes the explanation of the pin configuration of Arduino
UNO, Mega, Nano, Leonardo, Due and Lilypad.

Hello Guys! I hope you have learned all about Arduino in my previous guide. Before doing
any project based on the Arduino board it is very important that you should know the pin
configuration of the board. So in order to help you guys, in this blog, I will guide you over the
Pin configuration of each Arduino Model. After going through this blog you can do any
project of Arduino with ease.

You will learn pin configuration of the following models:


1. Arduino Uno(R3)
2. Arduino Mega (R3)
3. Arduino Nano
4. Arduino Leonardo
5. Arduino Due
6. LilyPad Arduino
7. Arduino Micro
8. Arduino Pro Mini

Arduino Uno (R3)


As we discussed we know that Arduino Uno is the most standard board available and
probably the best choice for a beginner. We can directly connect the board to the computer
via a USB Cable which performs the function of supplying the power as well as acting as a
serial port.

Image Source: diyi0t.com


Vin: This is the input voltage pin of the Arduino board used to provide input supply from an
external power source.

5V: This pin of the Arduino board is used as a regulated power supply voltage and it is used
to give supply to the board as well as onboard components.

3.3V: This pin of the board is used to provide a supply of 3.3V which is generated from a
voltage regulator on the board
GND: This pin of the board is used to ground the Arduino board.

Reset: This pin of the board is used to reset the microcontroller. It is used to Resets the
microcontroller.

Analog Pins: The pins A0 to A5 are used as an analog input and it is in the range of 0-5V.

Digital Pins: The pins 0 to 13 are used as a digital input or output for the Arduino board.

Serial Pins: These pins are also known as a UART pin. It is used for communication between
the Arduino board and a computer or other devices. The transmitter pin number 1 and
receiver pin number 0 is used to transmit and receive the data resp.

External Interrupt Pins: This pin of the Arduino board is used to produce the External
interrupt and it is done by pin numbers 2 and 3.

PWM Pins: This pins of the board is used to convert the digital signal into an analog by
varying the width of the Pulse. The pin numbers 3,5,6,9,10 and 11 are used as a PWM pin.

SPI Pins: This is the Serial Peripheral Interface pin, it is used to maintain SPI communication
with the help of the SPI library. SPI pins include:

1. SS: Pin number 10 is used as a Slave Select


2. MOSI: Pin number 11 is used as a Master Out Slave In
3. MISO: Pin number 12 is used as a Master In Slave Out
4. SCK: Pin number 13 is used as a Serial Clock

LED Pin: The board has an inbuilt LED using digital pin-13. The LED glows only when the
digital pin becomes high.

AREF Pin: This is an analog reference pin of the Arduino board. It is used to provide a
reference voltage from an external power supply.

Arduino Mega (R3)


The most important thing about this board is that the board has more input-output pins so it
is very beneficial for the Advanced Users or the people who want more pins for their projects.

Image Source: diyi0t.com


Vin: This is the input voltage pin of the Arduino board used to provide input supply from an
external power source.

5V: This pin of the Arduino board is used as a regulated power supply voltage and it is used
to give supply to the board as well as onboard components.

3.3V: This pin of the board is used to provide a supply of 3.3V which is generated from a
voltage regulator on the board

GND: This pin of the board is used to ground the Arduino board.
Reset: This pin of the board is used to reset the microcontroller It is used to Resets the
microcontroller.

Analog Pins: The pins A0 to A15 are used as an analog input and it is in the range of 0-5V.
The analog pins on this board can be used as a digital Input or Output pins.

Serial pins: It is used for communication between the Arduino board and a computer or other
devices.

The TXD and RXD are used to transmit & receive the serial data resp. It includes serial 0,
Serial 1, serial 2, Serial 3 as follows:

1. Serial 0: It consists of Transmitter pin number 1 and receiver pin number 0


2. Serial 1: It consists of Transmitter pin number 18 and receiver pin number 19
3. serial 2: It consists of Transmitter pin number 16 and receiver pin number 17
4. Serial 3: It consists of Transmitter pin number 14 and receiver pin number 15

External Interrupts pins: This pin of the Arduino board is used to produce the External
interrupt and it is done by the pin numbers 0,3,21,20,19,18.

I2C: This pin of the board is used for I2C communication.

1. Pin number 20 signifies Serial Data Line (SDA)and it is used for holding the data.
2. Pin number 21 signifies Serial Clock Line (SCL) and it is used for offering data
synchronization among the devices.

SPI Pins: This is the Serial Peripheral Interface pin, it is used to maintainSPI communication
with the help of the SPI library. SPI pins include:

1. MISO: Pin number 50 is used as a Master In Slave Out


2. MOSI: Pin number 51 is used as a Master Out Slave In
3. SCK: Pin number 52 is used as a Serial Clock
4. SS: Pin number 53 is used as a Slave Select

LED Pin: The board has an inbuilt LED using digital pin-13. The LED glows only when the
digital pin becomes high.

AREF Pin: This is an analog reference pin of the Arduino board. It is used to provide a
reference voltage from an external power supply.

Arduino Nano
The Arduino Uno and nano are similar, but the only difference is that its size. The UNO size is
2 times the nano size, so the Arduino nano is more breadboard friendly. It is used for portable
projects. The board has a mini USB cable slot.

Image Source: diyi0t.com


Vin: This is the input voltage pin of the Arduino board used to provide input supply from an
external power source.

5V: This pin of the Arduino board is used as a regulated power supply voltage and it is used
to give supply to the board as well as onboard components.

3.3V: This pin of the board is used to provide a supply of 3.3V which is generated from a
voltage regulator on the board

GND: This pin of the board is used to ground the Arduino board.

Reset: This pin of the board is used to reset the microcontroller. It is used to Resets the
microcontroller.

Analog Pins: The pins A0 to A7 are used as an analog input and it is in the range of 0-5V.

Digital Pins: The pins D0 to D13 are used as a digital input or output for the Arduino board.
Serial Pins: This pin is also known as a UART pin. It is used for communication between the
Arduino board and a computer or other devices. The transmitter pin number 1 and receiver
pin number 2 is used to transmit and receive the data resp.

External Interrupt Pins: This pin of the Arduino board is used to produce the External
interrupt and it is done by pin numbers 2 and 3.

PWM Pins: This pins of the board is used to convert the digital signal into an analog by
varying the width of the Pulse. The pin numbers 3,5,6,9,10 and 11 are used as a PWM pin.

SPI Pins: This is the Serial Peripheral Interface pin, it is used to maintainSPI communication
with the help of the SPI library. SPI pins include:

1. SS: Pin number 10 is used as a Slave Select


2. MOSI: Pin number 11 is used as a Master Out Slave In
3. MISO: Pin number 12 is used as a Master In Slave Out
4. SCK: Pin number 13 is used as a Serial Clock

I2C: This pin of the board is used for I2C communication.

1. Pin A4 signifies Serial Data Line (SDA)and it is used for holding the data.
2. Pin A5 signifies Serial Clock Line (SCL) and it is used for offering data
synchronization among the devices.

LED Pin: The board has an inbuilt LED using digital pin-13. The LED glows only when the
digital pin becomes high.

AREF Pin: This is an analog reference pin of the Arduino board. It is used to provide a
reference voltage from an external power supply.

Arduino Leonardo
The Arduino Leonardo has more number of digital input/ output and analog input pins. The
Arduino Leonardo can be powered via the micro USB connection or with an external power
supply.
Image Source: electroschematics.com
Vin: This is the input voltage pin of the Arduino board used to provide input supply from an
external power source.

5V: This pin of the Arduino board is used as a regulated power supply voltage and it is used
to give supply to the board as well as onboard components.

3.3V: This pin of the board is used to provide a supply of 3.3V which is generated from a
voltage regulator on the board

GND: This pin of the board is used to ground the Arduino board.

Reset: This pin of the board is used to reset the microcontroller. It is used to Resets the
microcontroller.

Analog Pins: The pins A0 to A11 are used as an analog input and it is in the range of 0-5V.

Digital Pins: The pins 4, 6, 8, 9, 10, and 12 are used as a digital input or output for the Arduino
board.

Serial Pins: This pin is also known as a UART pin. It is used for communication between the
Arduino board and a computer or other devices. The transmitter pin number 1 and receiver
pin number 0 is used to transmit and receive the data resp.
External Interrupt Pins: This pin of the Arduino board is used to produce the External
interrupt and it is done by pin numbers 2 and 3.

I2C: This pin of the board is used for I2C communication.

1. Pin number 2 signifies Serial Data Line (SDA)and it is used for holding the data.
2. Pin number 3 signifies Serial Clock Line (SCL) and it is used for offering data
synchronization among the devices.

LED Pin: The board has an inbuilt LED using digital pin-13. The LED glows only when the
digital pin becomes high.

AREF Pin: This is an analog reference pin of the Arduino board. It is used to provide a
reference voltage from an external power supply.

Arduino Due
Arduino Due is more preferable when there are many peripherals that need to connect the
board. This board has many numbers of PWM and ADC outputs so it can be more beneficial
to use the Due board where you will need more PWM and ADC pins. It is the perfect board for
powerful larger scale Arduino projects like designing complex systems like CNC or 3D
printer.

Image Source: javatpoint.com


Vin: This is the input voltage pin of the Arduino board used to provide input supply from an
external power source.

5V: This pin of the Arduino board is used as a regulated power supply voltage and it is used
to give supply to the board as well as onboard components.

3.3V: This pin of the board is used to provide a supply of 3.3V which is generated from a
voltage regulator on the board

IOREF: It stands for Input-Output voltage REFerence. It allows the shields to check the
operating voltage of the board.

GND: This pin of the board is used to ground the Arduino board.

Reset: This pin of the board is used to reset the microcontroller. It is used to Resets the
microcontroller.

Analog Pins: The pins A0 to A11 are used as an analog input and it is in the range of 0-5V.

Digital Pins: The pins 0 to 53 are used as a digital input or output for the Arduino board.

PWM Pins: This pins of the board is used to convert the digital signal into an analog by
varying the width of the Pulse. The pin numbers 2 to 13 are used as PWM pins.

SPI Pins: This pin is also known as a UART pin. It is used for communication between the
Arduino board and a computer or other devices. The transmitter pin and receiver pin are used
to transmit and receive the data resp.

I2C Communication: This pin of the board is used for I2C communication.

1. Serial Data Line (SDA): It is used for holding the data.


2. Serial Clock Line (SCL): It is used for offering data synchronization among the
devices.

Voltage for ADC: This pin of the Arduino board is used to map the voltage value to the integer
value. The voltage from 0 to 5 is mapped into the integer value from 0 to 1023.

Erase Button: This pin of the board is used to erase the Flash Memory of the microcontroller.
To erase, on the power of the board press and hold the Erase button for a few seconds.

LilyPad Arduino
Arduino Lilypad is very unique in its shape and applications among the other Arduino
boards. This Arduino Lilypad is based on the circular PCB with the wide holes at the corner
and is optimized for the e-textiles and wearable projects. The Arduino Lilypad does not have
built-in USB to UART converter as it is present in other Arduino modes.

Image Source: projectiot123.com


VCC: This pin of the Arduino board is connected to +5V or +3.3V for providing supply to the
board

GND: This pin of the board is used to ground the Arduino board.

Reset: This pin of the board is used to reset the microcontroller. It is used to Resets the
microcontroller.

Analog Pins: The pins A0 to A5 are used as an analog input and it is in the range of 0-5V.

Digital Pins: The board contains 14 digital pins that can be used as an input or output.

Serial Pins: This pin is also known as a UART pin. It is used for communication between the
Arduino board and a computer or other devices. The transmitter and are used to transmit and
receive the data resp.

PWM: These pins of the board are used to convert the digital signal into an analog by varying
the width of the Pulse. The pin numbers 9, 10, 15, 16, and 17 are used as PWM pins.

SPI Pins: This is the Serial Peripheral Interface pin, it is used to maintainSPI communication
with the help of the SPI library. SPI pins include:

1. SS: Pin number 16 is used as a Slave Select


2. MOSI: Pin number 17 is used as a Master Out Slave In
3. MISO: Pin number 18 is used as a Master In Slave Out
4. SCK: Pin number 19 is used as a Serial Clock

I2C Communication: This pin of the board is used for I2C communication.
1. Serial Data Line (SDA): It is used for holding the data.
2. Serial Clock Line (SCL): It is used for offering data synchronization among the
devices.

Arduino Micro
Arduino Micro is the smallest board in the Arduino Community. The Arduino Micro has more
number of analog input pins than the UNO board. It is essentially a shrunk-down version of
the Arduino Leonardo

Image Source: javatpoint.com


Vin: This is the input voltage pin of the Arduino board used to provide input supply from an
external power source.

5V: This pin of the Arduino board is used as a regulated power supply voltage and it is used
to give supply to the board as well as onboard components.

3.3V: This pin of the board is used to provide a supply of 3.3V which is generated from a
voltage regulator on the board

GND: This pin of the board is used to ground the Arduino board.
Reset: This pin of the board is used to reset the microcontroller. It is used to Resets the
microcontroller.

Analog Pins: The pins A0 to A11 are used as an analog input and it is in the range of 0-5V.

Digital Pins: The pins 4, 6, 8, 9, 10, and 12 are used as a digital input or output for the Arduino
board.

External Interrupt Pins: This pin of the Arduino board is used to produce the External
interrupt and it is done by pin number 0, 1, 2, and 3.

PWM Pins: This pins of the board is used to convert the digital signal into an analog by
varying the width of the Pulse. The pin numbers 3, 5, 6, 9, 10, 11, and 13 are used as PWM
pins.

Serial Pins: This pin is also known as a UART pin. It is used for communication between the
Arduino board and a computer or other devices. The transmitter pin number 1 and receiver
pin number 0 is used to transmit and receive the data resp.

I2C: This pin of the board is used for I2C communication.

1. Pin number 2 signifies Serial Data Line (SDA)and it is used for holding the data.
2. Pin number 3 signifies Serial Clock Line (SCL) and it is used for offering data
synchronization among the devices.

SPI Pins: This is the Serial Peripheral Interface pin, it is used to maintainSPI communication
with the help of the SPI library. SPI pins include:

1. SS: It is used as a Slave Select


2. MOSI: It is used as a Master Out Slave In
3. MISO: It is used as a Master In Slave Out
4. SCK: It is used as a Serial Clock

LED Pin: The board has an inbuilt LED using digital pin-13. The LED glows only when the
digital pin becomes high.

AREF Pin: This is an analog reference pin of the Arduino board. It is used to provide a
reference voltage from an external power supply.

Arduino Pro Mini


The Arduino Pro mini has the new pin called the RAW pin. The RAW PIN is the input to the
on-board regulator. You can connect up to 12V to the RAW pin and VCC will remain at a
constant voltage. This Arduino board is preferred by advanced users for greater flexibility
and small size.

Image Source: javatpoint.com


Vin: This is the input voltage pin of the Arduino board used to provide input supply from an
external power source.

VCC: This pin of the Arduino board is connected to +5V or +3.3V for providing supply to the
board

GND: This pin of the board is used to ground the Arduino board.

Reset: This pin of the board is used to reset the microcontroller. It is used to Resets the
microcontroller.

Analog Pins: The pins A0 to A7 are used as an analog input and it is in the range of 0-5V.

Digital Pins: The pins 2 to 13 are used as a digital input or output for the Arduino board.

External Interrupt Pins: This pin of the Arduino board is used to produce the External
interrupt and it is done by the pin number 4 and 5

PWM Pins: This pin of the board is used to convert the digital signal into an analog by
varying the width of the Pulse. The pin numbers 3, 5, 6,9,10, and 12 are used as a PWM pin.

Analog Comparator: Pin number 6 -AIN0 and pin number 7- AIN1 are connected to the
internal comparator.
SPI Pins: This is the Serial Peripheral Interface pin, it is used to maintainSPI communication
with the help of the SPI library. SPI pins include:

1. SS: Pin number 10 is used as a Slave Select


2. MISO: Pin number 11 is used as a Master In Slave Out
3. MOSI: Pin number 12 is used as a Master Out Slave In
4. SCK: Pin number 13 is used as a Serial Clock

You might also like