unfolder 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- unfolder-0.1.0/LICENSE +17 -0
- unfolder-0.1.0/PKG-INFO +79 -0
- unfolder-0.1.0/README.md +60 -0
- unfolder-0.1.0/pyproject.toml +35 -0
- unfolder-0.1.0/setup.cfg +4 -0
- unfolder-0.1.0/src/unfolder/__init__.py +6 -0
- unfolder-0.1.0/src/unfolder/__main__.py +35 -0
- unfolder-0.1.0/src/unfolder/data/LDR_DHT22_COMBINED.txt +82 -0
- unfolder-0.1.0/src/unfolder/data/Q01_DHT_Sensor.txt +77 -0
- unfolder-0.1.0/src/unfolder/data/Q02_LDR_Sensor.txt +70 -0
- unfolder-0.1.0/src/unfolder/data/Q03_PIR_Sensor.txt +64 -0
- unfolder-0.1.0/src/unfolder/data/Q04_DHT_MQTT.txt +181 -0
- unfolder-0.1.0/src/unfolder/data/Q05_REST_API_Supabase.txt +283 -0
- unfolder-0.1.0/src/unfolder/data/Q06_MQTT_Supabase.txt +376 -0
- unfolder-0.1.0/src/unfolder/data/Q07_ThingsBoard_MQTT.txt +116 -0
- unfolder-0.1.0/src/unfolder/data/Q08_CoAP_Server_Client.txt +277 -0
- unfolder-0.1.0/src/unfolder/data/Q09_MQTT_HiveMQ_Mosquitto.txt +179 -0
- unfolder-0.1.0/src/unfolder/data/Q10_CoAP_OpenMeteo_Supabase.txt +504 -0
- unfolder-0.1.0/src/unfolder/data/Q11_ISS_Tracking.txt +108 -0
- unfolder-0.1.0/src/unfolder/data/Q12_Earthquake_Analysis.txt +275 -0
- unfolder-0.1.0/src/unfolder/data/Q13_Weather_Analysis.txt +126 -0
- unfolder-0.1.0/src/unfolder/data/Q14_Air_Quality_Analysis.txt +138 -0
- unfolder-0.1.0/src/unfolder/data/Q15_Decision_Tree_Occupancy.txt +133 -0
- unfolder-0.1.0/src/unfolder/data/Q16_Linear_Regression_Temperature.txt +158 -0
- unfolder-0.1.0/src/unfolder/data/Q17_Random_Forest_Air_Quality.txt +173 -0
- unfolder-0.1.0/src/unfolder/data/temp.txt +3266 -0
- unfolder-0.1.0/src/unfolder/downloader.py +41 -0
- unfolder-0.1.0/src/unfolder.egg-info/PKG-INFO +79 -0
- unfolder-0.1.0/src/unfolder.egg-info/SOURCES.txt +30 -0
- unfolder-0.1.0/src/unfolder.egg-info/dependency_links.txt +1 -0
- unfolder-0.1.0/src/unfolder.egg-info/entry_points.txt +2 -0
- unfolder-0.1.0/src/unfolder.egg-info/top_level.txt +1 -0
unfolder-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Unfolder Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
unfolder-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: unfolder
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A downloadable collection of 19 text files.
|
|
5
|
+
Author: Unfolder Contributors
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: text-files,file-collection,downloader,resources
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Requires-Python: >=3.9
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# Unfolder
|
|
21
|
+
|
|
22
|
+
A downloadable collection of 19 text files.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install unfolder
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Download the complete folder
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
python -m unfolder download
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This creates an `unfolder` directory in the current working directory and extracts all 19 `.txt` files into it.
|
|
37
|
+
|
|
38
|
+
## Download to a specific location
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
unfolder download --destination "C:/Users/YourName/Desktop/my-text-files"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
The destination is the exact folder where the text files will be placed. It is created automatically if it does not exist.
|
|
45
|
+
|
|
46
|
+
You can also use the module form on systems where the command-line script is not on `PATH`:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python -m unfolder download --destination "./my-text-files"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Python import
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
import unfolder
|
|
56
|
+
|
|
57
|
+
folder = unfolder.download()
|
|
58
|
+
print(f"Files are available in: {folder}")
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Choose a custom destination from Python:
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
import unfolder
|
|
65
|
+
|
|
66
|
+
folder = unfolder.download("./my-text-files")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Existing files are skipped by default. To replace them:
|
|
70
|
+
|
|
71
|
+
```python
|
|
72
|
+
unfolder.download("./my-text-files", overwrite=True)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Notes
|
|
76
|
+
|
|
77
|
+
- The collection contains 19 plain-text (`.txt`) files.
|
|
78
|
+
- The files are bundled with the package, so no separate download server or internet connection is needed when extracting them.
|
|
79
|
+
- Importing `unfolder` does not create or download files. Call `unfolder.download()` when you want to extract the collection.
|
unfolder-0.1.0/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Unfolder
|
|
2
|
+
|
|
3
|
+
A downloadable collection of 19 text files.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install unfolder
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Download the complete folder
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
python -m unfolder download
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This creates an `unfolder` directory in the current working directory and extracts all 19 `.txt` files into it.
|
|
18
|
+
|
|
19
|
+
## Download to a specific location
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
unfolder download --destination "C:/Users/YourName/Desktop/my-text-files"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The destination is the exact folder where the text files will be placed. It is created automatically if it does not exist.
|
|
26
|
+
|
|
27
|
+
You can also use the module form on systems where the command-line script is not on `PATH`:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
python -m unfolder download --destination "./my-text-files"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Python import
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import unfolder
|
|
37
|
+
|
|
38
|
+
folder = unfolder.download()
|
|
39
|
+
print(f"Files are available in: {folder}")
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Choose a custom destination from Python:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import unfolder
|
|
46
|
+
|
|
47
|
+
folder = unfolder.download("./my-text-files")
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Existing files are skipped by default. To replace them:
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
unfolder.download("./my-text-files", overwrite=True)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Notes
|
|
57
|
+
|
|
58
|
+
- The collection contains 19 plain-text (`.txt`) files.
|
|
59
|
+
- The files are bundled with the package, so no separate download server or internet connection is needed when extracting them.
|
|
60
|
+
- Importing `unfolder` does not create or download files. Call `unfolder.download()` when you want to extract the collection.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "unfolder"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A downloadable collection of 19 text files."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [{ name = "Unfolder Contributors" }]
|
|
13
|
+
keywords = ["text-files", "file-collection", "downloader", "resources"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 3 - Alpha",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Operating System :: OS Independent",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.scripts]
|
|
25
|
+
unfolder = "unfolder.__main__:main"
|
|
26
|
+
|
|
27
|
+
[tool.setuptools]
|
|
28
|
+
package-dir = {"" = "src"}
|
|
29
|
+
include-package-data = true
|
|
30
|
+
|
|
31
|
+
[tool.setuptools.packages.find]
|
|
32
|
+
where = ["src"]
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.package-data]
|
|
35
|
+
unfolder = ["data/*.txt"]
|
unfolder-0.1.0/setup.cfg
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
|
|
5
|
+
from . import __version__, download
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main() -> None:
|
|
9
|
+
parser = argparse.ArgumentParser(
|
|
10
|
+
prog="unfolder",
|
|
11
|
+
description="Extract the Unfolder collection of text files.",
|
|
12
|
+
)
|
|
13
|
+
parser.add_argument("--version", action="version", version=f"unfolder {__version__}")
|
|
14
|
+
subparsers = parser.add_subparsers(dest="command", required=True)
|
|
15
|
+
|
|
16
|
+
download_parser = subparsers.add_parser("download", help="Extract all bundled text files")
|
|
17
|
+
download_parser.add_argument(
|
|
18
|
+
"--destination",
|
|
19
|
+
"-d",
|
|
20
|
+
default=None,
|
|
21
|
+
help="Target folder (default: ./unfolder)",
|
|
22
|
+
)
|
|
23
|
+
download_parser.add_argument(
|
|
24
|
+
"--overwrite",
|
|
25
|
+
action="store_true",
|
|
26
|
+
help="Overwrite files that already exist",
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
args = parser.parse_args()
|
|
30
|
+
if args.command == "download":
|
|
31
|
+
download(args.destination, overwrite=args.overwrite)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
if __name__ == "__main__":
|
|
35
|
+
main()
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
DHT sensor library
|
|
2
|
+
Adafruit Unified Sensor
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
sketch.ino:
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
#include <DHT.h>
|
|
9
|
+
|
|
10
|
+
#define DHTPIN 4
|
|
11
|
+
#define DHTTYPE DHT22
|
|
12
|
+
#define LDRPIN 34
|
|
13
|
+
|
|
14
|
+
DHT dht(DHTPIN, DHTTYPE);
|
|
15
|
+
|
|
16
|
+
void setup() {
|
|
17
|
+
Serial.begin(115200);
|
|
18
|
+
dht.begin();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
void loop() {
|
|
22
|
+
float temperature = dht.readTemperature();
|
|
23
|
+
float humidity = dht.readHumidity();
|
|
24
|
+
|
|
25
|
+
int light = analogRead(LDRPIN);
|
|
26
|
+
|
|
27
|
+
Serial.println("--------------------");
|
|
28
|
+
|
|
29
|
+
Serial.print("Temperature: ");
|
|
30
|
+
Serial.print(temperature);
|
|
31
|
+
Serial.println(" C");
|
|
32
|
+
|
|
33
|
+
Serial.print("Humidity: ");
|
|
34
|
+
Serial.print(humidity);
|
|
35
|
+
Serial.println(" %");
|
|
36
|
+
|
|
37
|
+
Serial.print("Light Reading: ");
|
|
38
|
+
Serial.println(light);
|
|
39
|
+
|
|
40
|
+
if (light > 500) {
|
|
41
|
+
Serial.println("Room: DARK");
|
|
42
|
+
Serial.println("Status: COMFY");
|
|
43
|
+
} else {
|
|
44
|
+
Serial.println("Room: BRIGHT");
|
|
45
|
+
Serial.println("Status: NOT COMFORTABLE");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
delay(2000);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
diagram.json:
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
{
|
|
56
|
+
"version": 1,
|
|
57
|
+
"author": "",
|
|
58
|
+
"editor": "wokwi",
|
|
59
|
+
"parts": [
|
|
60
|
+
{ "type": "board-esp32-devkit-c-v4", "id": "esp", "top": 0, "left": 0, "attrs": {} },
|
|
61
|
+
{ "type": "wokwi-dht22", "id": "dht1", "top": 0.3, "left": -111, "attrs": {} },
|
|
62
|
+
{
|
|
63
|
+
"type": "wokwi-photoresistor-sensor",
|
|
64
|
+
"id": "ldr1",
|
|
65
|
+
"top": -73.6,
|
|
66
|
+
"left": 77.6,
|
|
67
|
+
"attrs": {}
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
"connections": [
|
|
71
|
+
[ "esp:TX", "$serialMonitor:RX", "", [] ],
|
|
72
|
+
[ "esp:RX", "$serialMonitor:TX", "", [] ],
|
|
73
|
+
[ "dht1:VCC", "esp:3V3", "red", [] ],
|
|
74
|
+
[ "dht1:GND", "esp:GND.1", "black", [] ],
|
|
75
|
+
[ "dht1:SDA", "esp:4", "green", [] ],
|
|
76
|
+
[ "ldr1:VCC", "esp:3V3", "red", [] ],
|
|
77
|
+
[ "ldr1:GND", "esp:GND.1", "black", [] ],
|
|
78
|
+
[ "ldr1:AO", "esp:34", "blue", [] ]
|
|
79
|
+
],
|
|
80
|
+
"dependencies": {
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
DHT sensor library
|
|
2
|
+
Adafruit Unified Sensor
|
|
3
|
+
|
|
4
|
+
1.Develop an ESP32 program to read temperature and humidity values using a DHT22 sensor and display the readings using serial communication.
|
|
5
|
+
|
|
6
|
+
sketch.ino:
|
|
7
|
+
|
|
8
|
+
#include "DHT.h"
|
|
9
|
+
|
|
10
|
+
#define DHTPIN 4
|
|
11
|
+
#define DHTTYPE DHT22
|
|
12
|
+
|
|
13
|
+
DHT dht(DHTPIN, DHTTYPE);
|
|
14
|
+
|
|
15
|
+
void setup() {
|
|
16
|
+
Serial.begin(115200);
|
|
17
|
+
|
|
18
|
+
dht.begin();
|
|
19
|
+
|
|
20
|
+
Serial.println("DHT22 Sensor Started");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void loop() {
|
|
24
|
+
float humidity = dht.readHumidity();
|
|
25
|
+
float temperature = dht.readTemperature();
|
|
26
|
+
|
|
27
|
+
if (isnan(humidity) || isnan(temperature)) {
|
|
28
|
+
Serial.println("Failed to read from DHT22 sensor!");
|
|
29
|
+
delay(2000);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Serial.print("Temperature: ");
|
|
34
|
+
Serial.print(temperature);
|
|
35
|
+
Serial.println(" °C");
|
|
36
|
+
|
|
37
|
+
Serial.print("Humidity: ");
|
|
38
|
+
Serial.print(humidity);
|
|
39
|
+
Serial.println(" %");
|
|
40
|
+
|
|
41
|
+
Serial.println("--------------------");
|
|
42
|
+
|
|
43
|
+
delay(2000);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
diagram.json:
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
{
|
|
50
|
+
"version": 1,
|
|
51
|
+
"author": "",
|
|
52
|
+
"editor": "wokwi",
|
|
53
|
+
"parts": [
|
|
54
|
+
{
|
|
55
|
+
"type": "board-esp32-devkit-c-v4",
|
|
56
|
+
"id": "esp",
|
|
57
|
+
"top": 0,
|
|
58
|
+
"left": 0,
|
|
59
|
+
"attrs": {}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"type": "wokwi-dht22",
|
|
63
|
+
"id": "dht",
|
|
64
|
+
"top": -20,
|
|
65
|
+
"left": 200,
|
|
66
|
+
"attrs": {}
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"connections": [
|
|
70
|
+
["esp:TX", "$serialMonitor:RX", "", []],
|
|
71
|
+
["esp:RX", "$serialMonitor:TX", "", []],
|
|
72
|
+
["dht:VCC", "esp:3V3", "red", []],
|
|
73
|
+
["dht:GND", "esp:GND.1", "black", []],
|
|
74
|
+
["dht:SDA", "esp:4", "green", []]
|
|
75
|
+
],
|
|
76
|
+
"dependencies": {}
|
|
77
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
DHT sensor library
|
|
2
|
+
Adafruit Unified Sensor
|
|
3
|
+
|
|
4
|
+
2.Develop an ESP32 program to read light intensity using an LDR module and display the readings using serial communication.
|
|
5
|
+
|
|
6
|
+
sketch.ino:
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
#define LDR_PIN 34
|
|
10
|
+
|
|
11
|
+
void setup() {
|
|
12
|
+
Serial.begin(115200);
|
|
13
|
+
|
|
14
|
+
Serial.println("LDR Sensor Started");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
void loop() {
|
|
18
|
+
int lightValue = analogRead(LDR_PIN);
|
|
19
|
+
|
|
20
|
+
Serial.print("Light Intensity: ");
|
|
21
|
+
Serial.println(lightValue);
|
|
22
|
+
|
|
23
|
+
if (lightValue < 1500) {
|
|
24
|
+
Serial.println("Low Light");
|
|
25
|
+
}
|
|
26
|
+
else if (lightValue < 3000) {
|
|
27
|
+
Serial.println("Medium Light");
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
Serial.println("High Light");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Serial.println("--------------------");
|
|
34
|
+
|
|
35
|
+
delay(1000);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
diagram.json:
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
{
|
|
43
|
+
"version": 1,
|
|
44
|
+
"author": "",
|
|
45
|
+
"editor": "wokwi",
|
|
46
|
+
"parts": [
|
|
47
|
+
{
|
|
48
|
+
"type": "board-esp32-devkit-c-v4",
|
|
49
|
+
"id": "esp",
|
|
50
|
+
"top": 0,
|
|
51
|
+
"left": 0,
|
|
52
|
+
"attrs": {}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"type": "wokwi-photoresistor-sensor",
|
|
56
|
+
"id": "ldr",
|
|
57
|
+
"top": -20,
|
|
58
|
+
"left": 200,
|
|
59
|
+
"attrs": {}
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"connections": [
|
|
63
|
+
["esp:TX", "$serialMonitor:RX", "", []],
|
|
64
|
+
["esp:RX", "$serialMonitor:TX", "", []],
|
|
65
|
+
["ldr:VCC", "esp:3V3", "red", []],
|
|
66
|
+
["ldr:GND", "esp:GND.1", "black", []],
|
|
67
|
+
["ldr:AO", "esp:34", "green", []]
|
|
68
|
+
],
|
|
69
|
+
"dependencies": {}
|
|
70
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
DHT sensor library
|
|
2
|
+
Adafruit Unified Sensor
|
|
3
|
+
|
|
4
|
+
3.Develop an ESP32 program to detect motion using a PIR sensor and display the detection status using serial communication.
|
|
5
|
+
|
|
6
|
+
sketch.ino:
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
#define PIR_PIN 4
|
|
10
|
+
|
|
11
|
+
void setup() {
|
|
12
|
+
Serial.begin(115200);
|
|
13
|
+
|
|
14
|
+
pinMode(PIR_PIN, INPUT);
|
|
15
|
+
|
|
16
|
+
Serial.println("PIR Motion Detection Started");
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
void loop() {
|
|
20
|
+
int motion = digitalRead(PIR_PIN);
|
|
21
|
+
|
|
22
|
+
if (motion == HIGH) {
|
|
23
|
+
Serial.println("Motion Detected!");
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
Serial.println("No Motion");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
delay(1000);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
diagram.json:
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
{
|
|
37
|
+
"version": 1,
|
|
38
|
+
"author": "",
|
|
39
|
+
"editor": "wokwi",
|
|
40
|
+
"parts": [
|
|
41
|
+
{
|
|
42
|
+
"type": "board-esp32-devkit-c-v4",
|
|
43
|
+
"id": "esp",
|
|
44
|
+
"top": 0,
|
|
45
|
+
"left": 0,
|
|
46
|
+
"attrs": {}
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"type": "wokwi-pir-motion-sensor",
|
|
50
|
+
"id": "pir",
|
|
51
|
+
"top": -20,
|
|
52
|
+
"left": 200,
|
|
53
|
+
"attrs": {}
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"connections": [
|
|
57
|
+
["esp:TX", "$serialMonitor:RX", "", []],
|
|
58
|
+
["esp:RX", "$serialMonitor:TX", "", []],
|
|
59
|
+
["pir:VCC", "esp:3V3", "red", []],
|
|
60
|
+
["pir:GND", "esp:GND.1", "black", []],
|
|
61
|
+
["pir:OUT", "esp:4", "green", []]
|
|
62
|
+
],
|
|
63
|
+
"dependencies": {}
|
|
64
|
+
}
|