https://github.com/roggersanguzu/arduino-motion-sensor-led-control
This Repository illustrates a working system that can be implemeted using the NOR-GATE . The working results are elaborated when the LED - and Motor are turned up and down.
https://github.com/roggersanguzu/arduino-motion-sensor-led-control
Last synced: 3 months ago
JSON representation
This Repository illustrates a working system that can be implemeted using the NOR-GATE . The working results are elaborated when the LED - and Motor are turned up and down.
- Host: GitHub
- URL: https://github.com/roggersanguzu/arduino-motion-sensor-led-control
- Owner: roggersanguzu
- License: mit
- Created: 2023-10-28T09:17:44.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-29T07:11:00.000Z (almost 2 years ago)
- Last Synced: 2025-03-06T07:31:34.565Z (7 months ago)
- Language: C++
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Arduino Motion Sensor LED Control
This Repository illustrates a working system that can be implemeted using the NOR-GATE . The working results are elaborated when the LED - and Motor are turned up and down.
Below Shows the Hardware version and Software Version.

This project uses an Arduino to control an LED light using a motion sensor. The motion sensor and LED are connected to the Arduino, and the Arduino uses the motion sensor's input to control the state of the LED light.
## Overview
The Arduino reads the state of the motion sensor using the `digitalRead()` function. If the sensor detects motion, the Arduino turns on an LED light. If the sensor does not detect motion, the Arduino turns off the LED light.
The motion sensor and LED are connected to specific digital pins on the Arduino. The motion sensor's output is read from pins 3 and 4, and the LED is controlled by pins 5 and 6.
## Code Explanation
### Setup
In the `setup()` function, the digital pins connected to the motion sensor and LED are initialized using the `pinMode()` function. Pins 3 and 4 are set as INPUT to read the motion sensor's output, and pins 5 and 6 are set as OUTPUT to control the LED light.
The `Serial.begin(96000);` line initializes serial communication with a baud rate of 96000. This is used for debugging purposes and to print out the sensor's output to the serial monitor.
### Loop
In the `loop()` function, the Arduino reads the state of the motion sensor using the `digitalRead()` function. If the sensor detects motion (i.e., both pins 3 and 4 read LOW), the Arduino turns on the LED light by writing HIGH to pin 6. If the sensor does not detect motion, the Arduino turns off the LED light by writing LOW to pin 6.
The Arduino also controls a motor using pins 5 and 8. If the sensor detects motion, the Arduino turns on the motor by writing the maximum value (255) to pin 5. If the sensor does not detect motion, the Arduino turns off the motor by writing 0 to pin 5.
## How to Run
To run this project, you need an Arduino board, a motion sensor, an LED light, and a motor. Connect the motion sensor and LED light to the Arduino as described in the "Pinout" section below, and upload this code to the Arduino.
## Pinout
- Motion Sensor Output: Pins 3 and 4
- LED Control: Pin 6
- Motor Control: Pin 5