Compare commits
4 Commits
4aad7f3b74
...
8e6fb18c16
Author | SHA1 | Date | |
---|---|---|---|
8e6fb18c16 | |||
83ca37fb37 | |||
adf042c212 | |||
828a3710b0 |
@ -13,14 +13,17 @@ import time
|
|||||||
GPIO.setmode(GPIO.BCM)
|
GPIO.setmode(GPIO.BCM)
|
||||||
GPIO.setwarnings(False)
|
GPIO.setwarnings(False)
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
GPIO.setup(16,GPIO.IN)
|
GPIO.setup(16,GPIO.IN) # For IR sensor
|
||||||
|
GPIO.setup(26,GPIO.OUT) # For LED
|
||||||
|
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
if (GPIO.input(16)):
|
if (GPIO.input(16)):
|
||||||
print("No object")
|
print("No object")
|
||||||
|
GPIO.output(26,GPIO.LOW) # LED OFF when no object detected
|
||||||
else:
|
else:
|
||||||
print("Object Detected")
|
print("Object Detected")
|
||||||
|
GPIO.output(26,GPIO.HIGH) # LED ON when object detected
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
GPIO.cleanup()
|
GPIO.cleanup()
|
||||||
# END OF CODE
|
# END OF CODE
|
||||||
|
@ -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
|
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
|
# BEGINNING OF CODE
|
||||||
# NOTE: GPIO PIN 16 used
|
# NOTE: GPIO PIN 16 used
|
||||||
|
|
||||||
@ -29,6 +36,8 @@ try:
|
|||||||
print("Humidity: %-3.1f %%" % result.humidity)
|
print("Humidity: %-3.1f %%" % result.humidity)
|
||||||
else:
|
else:
|
||||||
print("Error: %d" % result.error_code)
|
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)
|
time.sleep(3)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("Program stopped by user.")
|
print("Program stopped by user.")
|
||||||
|
@ -8,6 +8,9 @@ Code from InternetOfThingsAndEmbeddedSystems (SPPU - Third Year - Computer Engin
|
|||||||
|
|
||||||
# BEGINNING OF CODE
|
# 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
|
cd /home/$(whoami)/Desktop/ # Changing current working directory to Desktop
|
||||||
raspicam-still -o test.jpg # Image
|
raspicam-still -o test.jpg # Image
|
||||||
libcamera-vid --codec h254 vid.h264
|
libcamera-vid --codec h254 vid.h264
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
3. [Assignment-3](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Practical/Assignment-3/)
|
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/)
|
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/)
|
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
|
## Question Papers
|
||||||
- [IN-SEM](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Question%20Papers/IN-SEM)
|
- [IN-SEM](https://git.kska.io/sppu-te-comp-content/InternetOfThingsAndEmbeddedSystems/src/branch/main/Question%20Papers/IN-SEM)
|
||||||
|
Loading…
Reference in New Issue
Block a user