메뉴 건너뛰기

TSKit

RPi Shutdown switch for safe.

조회 수 5139 추천 수 0 2014.12.04 18:25:56

 1.

http://www.3cc.org/blog/2013/01/raspberry-pi-shutdown-switch-safely-turning-off-the-pi/

All that’s left is to monitor pin 17 for activity, for which I used the code on the Raspberry Pi forum.

Placed in /home/pi/bin/button/shutdown.py

import RPi.GPIO as GPIO
import time
import os
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN)
while True:
if(GPIO.input(17)):
os.system("sudo shutdown -h now")
break
time.sleep(1)

Placed in /etc/rc.local on the line before “exit 0″

python /home/pi/bin/button/shutdown.py

Then the Pi will shutdown when the button is pressed for about 1 second – only the Power light will remain on (red) when it’s shut down. It’s worth noting that this won’t work if the Pi has crashed but that’s not an issue we often see.

 

 

2. Reference circuit.

BatteryAdapterSwitchCircuit_zpsdae2a018.jpg

List of Articles
번호 제목 글쓴이 날짜 조회 수
19 Mac os sierra(10.12.1) on LG 15nd530 file tskit 2016-12-12 39987
18 rpi serial clock file tskit 2016-10-14 5396
17 osx 10.10 on sense nt-p510 file tskit 2015-11-15 5255
16 해킨토시 설치(SUCCESS) file [1] tskit 2015-10-07 12815
15 Rpi3 auto ap mode. tskit 2014-12-08 6008
» RPi Shutdown switch for safe. file tskit 2014-12-04 5139
13 inxi install [1] tskit 2014-12-04 6455
12 갤럭시노트 3100mah 배터리 file tskit 2013-04-22 5180
11 7인치 a13 tablet file tskit 2012-11-22 6036
10 옵티머스원 ku3700 V33 커널 컴파일 중... file tskit 2011-11-04 9984
9 옵티머스원 ku3700 file tskit 2011-11-04 7366
8 옴팝 커널 컴파일 file tskit 2011-10-02 8015
7 framework-res.apk수정하기 tskit 2011-09-28 16211
6 initramfs 수정해보기 tskit 2011-09-27 9705
5 갤럭시k 컴파일해보기 tskit 2011-09-27 9388
4 갤럭시 안드로이드 오픈소스 tskit 2011-09-11 9084
3 고런처 배경화면 file tskit 2011-09-10 11372
2 옴드로이드 file tskit 2011-09-10 9562
1 안드로이드 게시판을 생성합니다. tskit 2011-09-10 7976