3
0

Added comments to activate virtual environment and added description for errors (1+2).

This commit is contained in:
K 2024-10-23 13:40:19 +05:30
parent adf042c212
commit 83ca37fb37
Signed by: notkshitij
GPG Key ID: C5B8BC7530F8F43F

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 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.")