3
0

Compare commits

..

4 Commits

5 changed files with 16 additions and 2 deletions

View File

@ -13,14 +13,17 @@ import time
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
GPIO.cleanup()
GPIO.setup(16,GPIO.IN)
GPIO.setup(16,GPIO.IN) # For IR sensor
GPIO.setup(26,GPIO.OUT) # For LED
try:
while True:
if (GPIO.input(16)):
print("No object")
GPIO.output(26,GPIO.LOW) # LED OFF when no object detected
else:
print("Object Detected")
GPIO.output(26,GPIO.HIGH) # LED ON when object detected
except KeyboardInterrupt:
GPIO.cleanup()
# END OF CODE

View File

@ -6,6 +6,13 @@ Problem Statement: Temperature and humidity sensing using DHT11.
Code from InternetOfThingsAndEmbeddedSystems (SPPU - Third Year - Computer Engineering - Content) repository on KSKA Git: https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems
"""
# NOTE: PLEASE REFER DHT11 repo by notkshitij for initialization: https://git.kska.io/notkshitij/DHT11/
# This code will only work in the virtual environment
# To enable the virtual environment, change current working directory using 'cd <DIR>'
# Activate the virtual environment using 'source bin/activate'
# Run this code 'python3 IoT\ -\ Code-4.py'
# BEGINNING OF CODE
# NOTE: GPIO PIN 16 used
@ -29,6 +36,8 @@ try:
print("Humidity: %-3.1f %%" % result.humidity)
else:
print("Error: %d" % result.error_code)
# Error 1 implies sensor not detected, thus no data
# Error 2 implies checksum error, data corrupted, i.e. GPIO connection might be lose
time.sleep(3)
except KeyboardInterrupt:
print("Program stopped by user.")

View File

@ -8,6 +8,9 @@ Code from InternetOfThingsAndEmbeddedSystems (SPPU - Third Year - Computer Engin
# BEGINNING OF CODE
# Run these command one by one manually in the terminal.
# Image and video file will be saved in Desktop directory of the cuurent user.
cd /home/$(whoami)/Desktop/ # Changing current working directory to Desktop
raspicam-still -o test.jpg # Image
libcamera-vid --codec h254 vid.h264

View File

@ -19,7 +19,6 @@
3. [Assignment-3](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Assignment-3/)
4. [Assignment-4](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Assignment-4/)
5. [Assignment-5](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Assignment-5/)
6. [Assignment-6](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Assignment-6/)
## Question Papers
- [IN-SEM](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Question%20Papers/IN-SEM)