메뉴 건너뛰기

TSKit

RPi Shutdown switch for safe.

조회 수 5317 추천 수 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
번호 제목 글쓴이 날짜 조회 수

Mac os sierra(10.12.1) on LG 15nd530 file

  • tskit
  • 2016-12-12
  • 조회 수 40213

rpi serial clock file

  • tskit
  • 2016-10-14
  • 조회 수 5585

osx 10.10 on sense nt-p510 file

  • tskit
  • 2015-11-15
  • 조회 수 5459

해킨토시 설치(SUCCESS) file [1]

  • tskit
  • 2015-10-07
  • 조회 수 13027

Rpi3 auto ap mode.

  • tskit
  • 2014-12-08
  • 조회 수 6190

RPi Shutdown switch for safe. file

  • tskit
  • 2014-12-04
  • 조회 수 5317

inxi install [1]

  • tskit
  • 2014-12-04
  • 조회 수 6650

갤럭시노트 3100mah 배터리 file

  • tskit
  • 2013-04-22
  • 조회 수 5318

7인치 a13 tablet file

  • tskit
  • 2012-11-22
  • 조회 수 6174

옵티머스원 ku3700 V33 커널 컴파일 중... file

  • tskit
  • 2011-11-04
  • 조회 수 10112

옵티머스원 ku3700 file

  • tskit
  • 2011-11-04
  • 조회 수 7533

옴팝 커널 컴파일 file

  • tskit
  • 2011-10-02
  • 조회 수 8156

framework-res.apk수정하기

  • tskit
  • 2011-09-28
  • 조회 수 16372

initramfs 수정해보기

  • tskit
  • 2011-09-27
  • 조회 수 9872

갤럭시k 컴파일해보기

  • tskit
  • 2011-09-27
  • 조회 수 9540

갤럭시 안드로이드 오픈소스

  • tskit
  • 2011-09-11
  • 조회 수 9278

고런처 배경화면 file

  • tskit
  • 2011-09-10
  • 조회 수 11514

옴드로이드 file

  • tskit
  • 2011-09-10
  • 조회 수 9704

안드로이드 게시판을 생성합니다.

  • tskit
  • 2011-09-10
  • 조회 수 8124