From 83ca37fb37653ad2f3b01ca6b0d5de538d9a2701 Mon Sep 17 00:00:00 2001 From: Kshitij Date: Wed, 23 Oct 2024 13:40:19 +0530 Subject: [PATCH] Added comments to activate virtual environment and added description for errors (1+2). --- Practical/Assignment-4/IoT - Code-4.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Practical/Assignment-4/IoT - Code-4.py b/Practical/Assignment-4/IoT - Code-4.py index 9e6c41f..b5df6d7 100644 --- a/Practical/Assignment-4/IoT - Code-4.py +++ b/Practical/Assignment-4/IoT - Code-4.py @@ -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 ' +# 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.")