0% found this document useful (0 votes)
29 views16 pages

Iot Hardware and Software: Prof. Sourabh Bhaskar, Assistant Professor

The document discusses IoT hardware and software used in Arduino platforms, describing the Arduino IDE for writing and compiling code, shields for extending capabilities, and basic concepts like variables, operators, conditionals, loops, and functions. It provides details on setting up the Arduino environment, loading example code, and using global variables accessible throughout a program.

Uploaded by

VIJAY KUAMR
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)
29 views16 pages

Iot Hardware and Software: Prof. Sourabh Bhaskar, Assistant Professor

The document discusses IoT hardware and software used in Arduino platforms, describing the Arduino IDE for writing and compiling code, shields for extending capabilities, and basic concepts like variables, operators, conditionals, loops, and functions. It provides details on setting up the Arduino environment, loading example code, and using global variables accessible throughout a program.

Uploaded by

VIJAY KUAMR
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/ 16

IoT Hardware and Software

Prof. Sourabh Bhaskar, Assistant Professor


Information Technology Engineering
CHAPTER-3
IoT Hardware and Software
Arduino Platform
Arduino is an open-source electronics platform based on easy-to-use hardware and
software.

• Interested amateurs over other systems:


- Inexpensive
- Cross-platform
- Simple, clear programming environment
- Open source and extensible software
- Open source and extensible hardware
Arduino IDE
• IDE stands for Integrated Development Environment – An official software
introduced by Arduino.cc, that is mainly used for writing, compiling and
uploading the code in the Arduino Device.

• Almost all Arduino modules are compatible with this software that is an open
source and is readily available to install and start compiling the code on the go.
Compiling Code

• Steps for compiling code:


- Open a new sketch in Arduino IDE
- Write your program / Code
- Save your program
- Press verify button on top left corner
- After that press upload button
Arduino Shields

• Shields are boards that can be plugged on top of the Arduino PCB extending
its capabilities.

- Ethernet Shield
- Relay Shield
- Proto Shield
- Motor Shield
- LCD Shield
- Capacitive Touchpad Shield
- GSM/GPRS Shield
- microSD Shield
Arduino Basic Setup: Setting Up Your Environment

Step 1: Download and Install the IDE


Visit http://www.arduino.cc/en/main/software to download the latest Arduino
IDE version for your computer’s operating system.

Step 2: Get the Arduino COM Port Number

Step 3: Configure the IDE

Step 4: Loading a Basic Example


Variables

• A variable is a way of naming and storing a value for later use by the
program, such as data from a sensor or an intermediate value used in a
calculation.

• Example:

int inputVariable1;
int inputVariable2 = 0; // both are correct
Arduino - Operators
• An operator is a symbol that tells the compiler to perform specific
mathematical or logical functions. C language is rich in built-in operators and
provides the following types of operators −
- Arithmetic Operators
+-*/%
- Comparison Operators
== != < > <= >=
- Boolean Operators
&& || !
- Bitwise Operators
&|^
- Compound Operators
++ -- +=
Conditionals Loops : while
• A while loop will loop continuously, and infinitely, until the expression inside
the parenthesis, () becomes false.
• Syntax
while (condition) {
// statement(s)
}
• Example Code
var = 0;
while (var < 200) {
// do something repetitive 200 times
var++;
}
Conditionals Loops : for
• The for statement is used to repeat a block of statements enclosed in curly
braces. An increment counter is usually used to increment and terminate the
loop. The for statement is useful for any repetitive operation, and is often used
in combination with arrays to operate on collections of data/pins.

• Syntax
for (initialization; condition; increment) {
// statement(s);
}
Conditionals Loops : for
• Example Code

// Dim an LED using a PWM pin


int PWMpin = 10;
void setup() {
// no setup needed
}
void loop() {
for (int i = 0; i <= 255; i++) {
analogWrite(PWMpin, i);
delay(10);
}
}
Arduino - Functions
• setup()
The setup() work is considered when a sketch begins. Use it to instate factors,
pin modes, begin utilizing libraries, and so forth. The setup() capacity will just
run once, after each powerup or reset of the Arduino board.

• loop()
In void loop(), your code will repeat over and over again.
Arduino - Functions
• For controlling the Arduino board and performing computations.
Digital I/O Time
- digitalRead() - delay()
- digitalWrite()
- pinMode()
Analog I/O
- analogRead()
- analogReference()
- analogWrite()
Arduino - Global Variables
• if you want to be able to use a variable anywhere in your program, you can
declare at the top of your code. This is called a global variable; here's an
example:

int pin = 13;


void setup()
{
pinMode(pin, OUTPUT);
}
void loop()
{
digitalWrite(pin, HIGH);
}
www.paruluniversity.ac.in

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy