Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
iot-project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Khin Zin Zin Thin
iot-project
Commits
0caa66b6
Commit
0caa66b6
authored
1 month ago
by
Khin Zin Zin Thin
Browse files
Options
Downloads
Patches
Plain Diff
add final project 및 보고서pdf
parent
5adfa2d6
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.DS_Store
+0
-0
0 additions, 0 deletions
.DS_Store
IoT_final_project/IoT_final_project.ino
+21
-12
21 additions, 12 deletions
IoT_final_project/IoT_final_project.ino
IoT_final_project/IoTproject보고서.pdf
+0
-0
0 additions, 0 deletions
IoT_final_project/IoTproject보고서.pdf
with
21 additions
and
12 deletions
.DS_Store
+
0
−
0
View file @
0caa66b6
No preview for this file type
This diff is collapsed.
Click to expand it.
IoT_final_project/IoT_final_project.ino
+
21
−
12
View file @
0caa66b6
...
...
@@ -21,6 +21,7 @@ RTC_DS3231 rtc;
// --- 전역 변수 ---
int
riskScore
=
0
;
String
statusText
=
""
;
unsigned
long
bootTime
;
// --- Common Anode (VCC) LED용 반전 RGB 출력 ---
void
setRGB
(
int
r
,
int
g
,
int
b
)
{
...
...
@@ -43,6 +44,8 @@ void setup() {
pinMode
(
BLUE_PIN
,
OUTPUT
);
pinMode
(
BUZZER_PIN
,
OUTPUT
);
bootTime
=
millis
();
// 시스템 시작 시간 기록
if
(
rtc
.
lostPower
())
{
Serial
.
println
(
"RTC had lost power. Setting time..."
);
rtc
.
adjust
(
DateTime
(
F
(
__DATE__
),
F
(
__TIME__
)));
// 현재 컴퓨터 시간으로 설정
...
...
@@ -61,9 +64,14 @@ void loop() {
// --- 위험도 판단 ---
riskScore
=
0
;
if
(
temp
>
30
||
hum
>
80
)
riskScore
+=
2
;
if
(
light
<
200
)
riskScore
+=
1
;
if
(
light
>
800
)
riskScore
+=
1
;
// 시스템 시작 후 5초가 지난 경우에만 PIR 조건 적용
if
(
millis
()
-
bootTime
>
5000
)
{
if
(
pir
==
HIGH
&&
(
hour
>=
20
||
hour
<
6
))
riskScore
+=
2
;
}
// 상태 판단 및 출력
if
(
riskScore
>=
4
)
{
statusText
=
"Danger"
;
setRGB
(
255
,
0
,
0
);
...
...
@@ -71,18 +79,18 @@ void loop() {
tone
(
BUZZER_PIN
,
1000
);
delay
(
300
);
noTone
(
BUZZER_PIN
);
delay
(
200
);
}
}
else
if
(
riskScore
>=
2
&&
riskScore
<
4
)
{
}
else
if
(
riskScore
>=
2
)
{
statusText
=
"Warning"
;
setRGB
(
255
,
150
,
0
);
tone
(
BUZZER_PIN
,
600
);
delay
(
200
);
noTone
(
BUZZER_PIN
);
delay
(
200
);
tone
(
BUZZER_PIN
,
600
);
delay
(
200
);
noTone
(
BUZZER_PIN
);
}
else
{
statusText
=
"Normal"
;
setRGB
(
0
,
255
,
0
);
// 초록
setRGB
(
0
,
255
,
0
);
noTone
(
BUZZER_PIN
);
}
//
---
LCD 출력
---
// LCD 출력
lcd
.
clear
();
lcd
.
setCursor
(
0
,
0
);
lcd
.
print
(
"T:"
);
...
...
@@ -94,7 +102,7 @@ void loop() {
lcd
.
print
(
"Risk: "
);
lcd
.
print
(
statusText
);
//
---
Serial 출력
---
// Serial 출력
Serial
.
println
(
"=== Sensor Data ==="
);
Serial
.
print
(
"Temp: "
);
Serial
.
println
(
temp
);
Serial
.
print
(
"Hum : "
);
Serial
.
println
(
hum
);
...
...
@@ -102,6 +110,7 @@ void loop() {
Serial
.
print
(
"PIR: "
);
Serial
.
println
(
pir
);
Serial
.
print
(
"Hour: "
);
Serial
.
println
(
hour
);
Serial
.
print
(
"Risk: "
);
Serial
.
println
(
statusText
);
Serial
.
print
(
"Riskscore: "
);
Serial
.
println
(
riskScore
);
Serial
.
println
(
"====================
\n
"
);
delay
(
2000
);
...
...
This diff is collapsed.
Click to expand it.
IoT_final_project/IoTproject보고서.pdf
+
0
−
0
View file @
0caa66b6
No preview for this file type
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment