본문 바로가기

IoT

[Raspberry Pi] WebIOPi 설치 방법

1) wget을 이용하여 파일 다운로드
WebIOPi 의 버전은 최신버전에 맞게 수정해서 다운로드 받으면 됨
 
2) 압축 해제
$ tar -xvzf WebIOPi-0.7.1.tar.gz
 
3) 설치
$ cd WebIOPi-0.7.1
$ sudo ./setup.sh
 
4) 실행
도움말이 필요하면 아래와 같이...
$ sudo webiopi -h
WebIOPi command-line usage
webiopi [-h] [-c config] [-l log] [-s script] [-d] [port]
Options:
  -h, --help Display this help
  -c, --config file Load config from file
  -l, --log file Log to file
  -s, --script file Load script from file
  -d, --debug Enable DEBUG
Arguments:
  port Port to bind the HTTP Server
 
기본 포트로 실행하려면 아래와 같이. 만일 포트를 변경하고 싶으면 맨 뒤에 포트번호를 입력한다.
$ sudo webiopi -c config

5) 백그라운드에서 실행/종료
$ sudo /etc/init.d/webiopi start
$ sudo /etc/init.d/webiopi stop

6) 시스템 부팅될 때 자동으로 실행 또는 제거
$ sudo update-rc.d webiopi defaults
$ sudo update-rc.d webiopi remove

내 Raspberry Pi 2에 설치하고 확인해 본 바 webiopi 0.7.1 버전은 Pi 2에서 정상 동작하지 않는다. 정상동작하도록 하려면 아래와 같이 소스코드를 수정해야 한다.

1.python/native/cpuinfo.c,change "BCM2708" to "BCM2709";
2.python/native/gpio.c, change "#define BCM2708_PERI_BASE 0x20000000" to "#define BCM2708_PERI_BASE 0x3f000000";
3.run setup.sh again.

# 참고사이트
https://code.google.com/p/webiopi/wiki/INSTALL
https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=98981
http://javedmandary.blogspot.kr/2015/04/control-gpio-pins-on-raspberry-pi-2.html

 


'IoT' 카테고리의 다른 글

Raspberry Pi 에서 node.js를 이용하여 온도/습도 측정  (0) 2016.11.27
[Raspberry Pi] Node.js 설치하기  (0) 2015.08.09