Exp-1 4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

DEPARTMENT OF

COMPUTER SCIENCE & ENGINEERING

Experiment 1.4
Student Name: Ajay Chaudhary UID:20BCS1204
Branch: CSE Section/Group:20BCS704-A
Semester: 6th Date of Performance:7/3/2023
Subject Name: IOT Subject Code:20CSP358

1. Aim/Overview of the practical:


Program to interface the Arduino/Raspberry Pi with LED and blinking application.

2. Apparatus / Simulator Used:

Components Required:
 You will need the following components −
 1 × Breadboard
 1 × Arduino Uno R3
 1 × LED
 1 × 330Ω Resistor
 2 × Jumper

3. Objective:

1. Learn about interfacing.


2. Learn about IoT programming.

4. Theory:

LEDs are small, powerful lights that are used in many different applications. To start, we
will work on blinking an LED, the Hello World of micro controllers.

It is as simple as turning a light on and off. Establishing this important baseline will give
you a solid foundation as we work towards experiments that are more complex.

Arduino is a project, open-source hardware, and software platform used to design and
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

build electronic devices. It designs and manufactures microcontroller kits and single-
board interfaces for building electronics projects.

The Arduino boards were initially created to help the students with the non-technical
background.

The designs of Arduino boards use a variety of controllers and microprocessors.

The Arduino board consists of sets of analog and digital I/O (Input / Output) pins, which
are further interfaced to breadboard, expansion boards, and other circuits.

Such boards feature the model, Universal Serial Bus (USB), and serial communication
interfaces, which are used for loading programs from the computers.

Step 1: Start a new sketch in the Arduino IDE. Start a new sketch in the Arduino IDE:
Step 2: Set the pin Mode for Pin 3. ...
Step 3: Set Pin 3 HIGH. ...
Step 4: Compile the code. ...
Step 5: Upload the code to Arduino.

CASE STUDY I
int ledPin=8; //definition digital 8 pins as pin to control the LED
void setup()
{
pinMode(ledPin,OUTPUT); //Set the digital 8 port mode, OUTPUT: Output mode
}
void loop()
{
digitalWrite(ledPin,HIGH); //HIGH is set to about 5V PIN8
delay(1000); //Set the delay time, 1000 = 1S
digitalWrite(ledPin,LOW); //LOW is set to about 5V PIN8
delay(1000); //Set the delay time, 1000 = 1S
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Output

CASE STUDY II

Changing the delay in LED Lights :-

int ledPin=8; //definition digital 8 pins as pin to control the LED


void setup()
{
pinMode(ledPin,OUTPUT); //Set the digital 8 port mode, OUTPUT: Output mode
}
void loop()
{
digitalWrite(ledPin,HIGH); //HIGH is set to about 5V PIN8
delay(5000);
digitalWrite(ledPin,LOW); //LOW is set to about 5V PIN8
delay(6000);
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

CASE STUDY II
Blinking of LED and the 13th pin light side by side .

void setup()
{
pinMode(13,OUTPUT);
pinMode(9,OUTPUT);
}
void loop()
{
digitalWrite(13,HIGH);
digitalWrite(9,LOW);
delay(1500);
digitalWrite(13,LOW);
digitalWrite(9,HIGH);
delay(1000);
}
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING

Led and the 13th pin light will blink side by side .

You might also like