Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flame-node
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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ThiefSil
flame-node
Commits
c8d70a57
Commit
c8d70a57
authored
4 months ago
by
도혁 함
Browse files
Options
Downloads
Patches
Plain Diff
chore: 최종 주석
parent
3ea44671
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
flame.c
+19
-19
19 additions, 19 deletions
flame.c
with
19 additions
and
19 deletions
flame.c
+
19
−
19
View file @
c8d70a57
...
@@ -9,33 +9,33 @@
...
@@ -9,33 +9,33 @@
#include
<signal.h>
#include
<signal.h>
/* 상수 정의 */
/* 상수 정의 */
#define BUFFER_MAX 3
// 버퍼 크기
#define BUFFER_MAX 3 // 버퍼 크기
#define DIRECTION_MAX 256
// 방향 경로 최대 길이
#define DIRECTION_MAX 256 // 방향 경로 최대 길이
#define VALUE_MAX 256
// 값 경로 최대 길이
#define VALUE_MAX 256 // 값 경로 최대 길이
#define IN 0
// GPIO 입력 모드
#define IN 0 // GPIO 입력 모드
#define OUT 1
// GPIO 출력 모드
#define OUT 1 // GPIO 출력 모드
#define LOW 0
// GPIO LOW 상태
#define LOW 0 // GPIO LOW 상태
#define HIGH 1
// GPIO HIGH 상태
#define HIGH 1 // GPIO HIGH 상태
#define BUFFER_SIZE 1024
// 소켓 버퍼 크기
#define BUFFER_SIZE 1024 // 소켓 버퍼 크기
#define POUT 23
// 초음파 트리거 핀
#define POUT 23 // 초음파 트리거 핀
#define PIN 24
// 초음파 에코 핀
#define PIN 24 // 초음파 에코 핀
#define FLAME 21
// 불꽃 센서 핀
#define FLAME 21 // 불꽃 센서 핀
#define GREEN 17
// 초록색 LED 핀
#define GREEN 17 // 초록색 LED 핀
#define RED 22
// 적색 LED 핀
#define RED 22 // 적색 LED 핀
#define BUZZER 27
// 부저 핀
#define BUZZER 27 // 부저 핀
int
fireAlarmNotes
[]
=
{
880
,
880
,
0
,
880
,
880
,
0
,
988
,
988
,
0
,
880
,
880
,
0
};
// 부저 알림용 음계 배열
int
fireAlarmNotes
[]
=
{
880
,
880
,
0
,
880
,
880
,
0
,
988
,
988
,
0
,
880
,
880
,
0
};
// 부저 알림용 음계 배열
/* 전역 변수 */
/* 전역 변수 */
struct
sockaddr_in
server_addr
;
// 서버 주소 구조체
struct
sockaddr_in
server_addr
;
// 서버 주소 구조체
int
park
=
0
;
// 주차 상태: 0 = 비어있음, 1 = 주차됨
int
park
=
0
;
// 주차 상태: 0 = 비어있음, 1 = 주차됨
int
setFire
=
1
;
// 화재 상태: 1 = 정상, 0 = 화재 발생
int
setFire
=
1
;
// 화재 상태: 1 = 정상, 0 = 화재 발생
int
sock
;
// 소켓 디스크립터
int
sock
;
// 소켓 디스크립터
int
redLed
=
2
;
// 초기 LED 상태
int
redLed
=
2
;
// 초기 LED 상태
int
CLEAR
=
1
;
// 초기 화재 진압상태 1 = 화재 진압 상태 0 = 화재 미진압 상태
int
CLEAR
=
1
;
// 초기 화재 진압상태 1 = 화재 진압 상태 0 = 화재 미진압 상태
pthread_t
ultra_thread
,
flame_thread
,
receive_thread
;
// 스레드 변수
pthread_t
ultra_thread
,
flame_thread
,
receive_thread
;
// 스레드 변수
...
@@ -72,7 +72,7 @@ void *ultrasonic_sensor(void *arg) {
...
@@ -72,7 +72,7 @@ void *ultrasonic_sensor(void *arg) {
while
(
1
)
{
while
(
1
)
{
GPIOWrite
(
POUT
,
HIGH
);
// 트리거 신호 발생
GPIOWrite
(
POUT
,
HIGH
);
// 트리거 신호 발생
usleep
(
10
);
// 10마이크로초 유지
usleep
(
10
);
// 10마이크로초 유지
GPIOWrite
(
POUT
,
LOW
);
// 트리거 신호 종료
GPIOWrite
(
POUT
,
LOW
);
// 트리거 신호 종료
/* 에코 신호 수신 시작 */
/* 에코 신호 수신 시작 */
while
(
GPIORead
(
PIN
)
==
LOW
)
while
(
GPIORead
(
PIN
)
==
LOW
)
...
...
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