Skip to content

Commit

Permalink
Merge pull request #28 from nishant-giri/main
Browse files Browse the repository at this point in the history
Add Automatic Light Switch
  • Loading branch information
jaguar017 authored Oct 17, 2021
2 parents 760d195 + 3e80d88 commit 6ed290a
Show file tree
Hide file tree
Showing 6 changed files with 2,109 additions and 2 deletions.
2,053 changes: 2,053 additions & 0 deletions Automatic Light Switch/Automatic Light Switch.brd

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions Automatic Light Switch/Automatic-Light-Switch.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Automatic Light Switch - Nishant Giri

void setup()
{
// Configure Pins as Input and Output
pinMode(2, INPUT);
pinMode(8, OUTPUT);
}
void loop()
{
// Get Data from Sensor Port
int sensor = digitalRead(2);
// Pin State Change (0 to 1)
if(sensor == HIGH)
{
// Turn ON LED
digitalWrite(8, HIGH);
}
// Pin State Change (1 to 0)
else
{
// Turn OFF LED
digitalWrite(8, LOW);
}
// Delay of 10ms for LED
delay(10);
}
28 changes: 28 additions & 0 deletions Automatic Light Switch/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Automatic Light Switch

## About the Project

Automatic Light Switch using Arduino and PIR Sensor.

---

## Project Components

1. Arduino Uno R3 ×1
2. Breadboard ×1
3. Connecting Wires
4. LED ×1
5. PIR Sensor ×1
6. Resistor (200 Ω) ×1

---

## Programming Language

C++

---

## Tinkercad Simulation

[Automatic Light Switch](https://www.tinkercad.com/things/fbEomPu592H)
1 change: 0 additions & 1 deletion Automatic Light Switch/readme.md

This file was deleted.

2 changes: 1 addition & 1 deletion Happy Birthday Song - Arduino/Happy-Birthday-Song.ino
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void playMusicalNotes(char musicalNote, int musicDuration)
int speed = 5;
for(int i = 0; i < 17; i++)
{
if (musicalScale[i] == musicalNote)
if(musicalScale[i] == musicalNote)
{
int newMusicDuration = musicDuration / speed;
playMusicalTones(musicalTones[i], newMusicDuration);
Expand Down

0 comments on commit 6ed290a

Please sign in to comment.