Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
SafePI
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
SafePI
Commits
502a3d47
Commit
502a3d47
authored
Apr 20, 2016
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add example shutdown python script
parent
20dcbf17
Pipeline
#14
skipped
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
0 deletions
+16
-0
safepy_shutdown.py
safepy_shutdown.py
+16
-0
No files found.
safepy_shutdown.py
0 → 100644
View file @
502a3d47
#!/usr/bin/env python
import
RPi.GPIO
as
GPIO
import
time
import
os
SAFEPI_PIN
=
36
GPIO
.
setmode
(
GPIO
.
BOARD
)
GPIO
.
setup
(
SAFEPI_PIN
,
GPIO
.
IN
,
pull_up_down
=
GPIO
.
PUD_UP
)
while
True
:
if
(
GPIO
.
input
(
SAFEPI_PIN
)
==
False
):
print
"SafePI detected power loss. Shutting down the system"
os
.
system
(
"shutdown -h now"
)
break
time
.
sleep
(
1
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment