Toggle navigation
Toggle navigation
This project
Loading...
Sign in
cse437_e
/
smartdoorlock-backend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김유현
2020-11-14 11:22:13 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9a052a9d1dfb83e00c69d7bd071edb8ab3700563
9a052a9d
1 parent
e504a48c
edit videorecord
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
api/videorecord.py
api/videorecord.py
View file @
9a052a9
...
...
@@ -21,8 +21,8 @@ def record() :
#'''
# rpi setting
GPIO
.
setmode
(
GPIO
.
BCM
)
PIR_PIN
=
7
GPIO
.
setup
(
PIR_PIN
,
GPIO
.
IN
)
pir_pin
=
7
GPIO
.
setup
(
pir_pin
,
GPIO
.
IN
)
camera
=
PiCamera
()
#'''
...
...
@@ -33,7 +33,7 @@ def record() :
serializer = RecordSerializer(target, many = False)
state = serializer.data['recording']
'''
if
GPIO
.
input
(
PIR_PIN
):
# motion detected
if
GPIO
.
input
(
pir_pin
):
# motion detected
# take a video
camera
.
resolution
=
[
320
,
240
]
camera
.
start_preview
()
...
...
@@ -44,7 +44,9 @@ def record() :
camera
.
start_recording
(
output
=
vid_path
)
time
.
sleep
(
1
)
camera
.
capture
(
thumbnail_path
)
time
.
sleep
(
5
)
while
GPIO
.
input
(
pir_pin
):
print
(
"recoring.."
)
time
.
sleep
(
2
)
camera
.
stop_recording
()
camera
.
stop_preview
()
...
...
@@ -69,4 +71,4 @@ def record() :
if
__name__
==
'__main__'
:
record
()
\ No newline at end of file
record
()
...
...
Please
register
or
login
to post a comment