0% found this document useful (0 votes)
11 views5 pages

4164 IoT Assignment

iot
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)
11 views5 pages

4164 IoT Assignment

iot
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/ 5

ASSIGNMENT-II (IoT Session (21/6/2024)

Name: Miteshkumar Gohil


Enrollment no: 23BT04199
Branch: B.Tech CSE Semester 2
Internship IoT Assignment

Task 1-
In Arduino Uno, connect 3 LEDs namely RED, YELLOW and
GREEN to 3 different GPIO Pins and make a traffic signal so
that RED is on for 30 seconds , YELLOW for 5 seconds and
GREEN for 25 seconds.

void setup()
{
pinMode(11, OUTPUT); //green pinMode
(12, OUTPUT); //yellow pinMode
(13, OUTPUT); //red pinMode
Serial.begin(115200);
}
void loop()
{
digitalWrite(11,LOW);
digitalWrite(13,HIGH);
delay(30000);
digitalWrite(13, LOW);
digitalWrite(12, HIGH);
delay(5000);
digitalWrite(12, LOW);
digitalWrite(11, HIGH);
delay(25000);
}
Task 2-
In Arduino Uno, Connect push button and LED such that
when push button is pressed then LED is on otherwise is
OFF.

void setup() {
pinMode(11, OUTPUT);
pinMode(12, INPUT);
Serial.begin(115200);
}
void loop() {
if (digitalRead(12) == LOW) {
digitalWrite(13, HIGH);
}
else {
digitalWrite(13, LOW);
}
}
Task 3-
In the Mini Piano project, Generate SAREGAMAPADHANISA
using beats accordingly.

#include "pitches.h"
#define sp 13
const int buttonTones[] = {
NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4,
NOTE_G4, NOTE_A4, NOTE_C4, NOTE_B5
};
void setup() {
pinMode(sp,OUTPUT);
}
void loop() {
for(int i=0;i<8;i++)
{
tone(sp, buttonTones[i]);
delay(1000);
noTone(sp);
delay(100);
}
}
Task 4-
In ESP32, try to blink the LED which is connected to pin 2
at every 5 second on and 10 seconds off.

void setup()
{
pinMode(2, OUTPUT);
Serial.begin(115200);
}

void loop()
{
digitalWrite(2, HIGH);
delay(5000);
digitalWrite(2, LOW);
delay(10000);
}

You might also like