본문 바로가기

전체 글

Raspberry Pi 에서 node.js를 이용하여 온도/습도 측정 최근 Raspberry Pi2에 Raspbian을 새로 설치하고 여러 사이트들을 참조하여 node.js를 이용하여 온도/습도를 알아오는 코드를 작성해 보았다.우선 node.js까지 설치가 되어 있다는 가정하에 필요한 모듈들 설치 및 코드 작성하는 방법에 대해 기술했다. Raspberry Pi2 에 DHT11 온도 습도 센서 연결DHT11 sensor와 RPI2 간 연결은 아래와 같이 연결했다.DHT11 RPI2 GPIO GROUND GROUND DATA GPIO4 PWR 3.5V bcm2835 설치Broadcom BCM 2835용 C Library를 설치한다. 이 라이브러리는 Raspberry Pi에서 GPIO에 access 할 수 있는 기능을 제공한다.(참조: http://www.airspayce.co.. 더보기
json-server를 이용한 초간단 Mock REST API 서버 만들기 back-end server API를 제공하기 전, prototype을 미리 user에게 제공하거나 또는 테스트를 위해 mock server 가 필요할 때 json-server를 이용하면 쉽게 개발이 가능하다. REST API 에 대한 Mock server 개발이 가능하다는 제약이 있다. 초간단 mock server 개발이 아닌 다양한 에러케이스와 validation 기능을 추가하기 위해서는 추가로 middleware, module 등을 개발하여 추가할 수 있다. [초간단 REST API Mock server 만들기]json resource 에 접근할 수 있는 CRUD REST API 서버를 만들어 보겠다. 1. json-server 설치하기npm을 이용하여 json-server를 설치한다.sudo np.. 더보기
Good Morning English - 10/14/2016 Today's ExpressionI've run all over this islandBuild up your confidenceWhy the taking a walk feel so refreshScreen EnglishDose mighty eagle still live?마이티 이글이 아직까지 산대?Did he ever live? And if he did live, where would he live?그가 살기나 한거야? 만일 산다면, 어디에 사는거야?By the lake of wisdom in the ancient tree.오래된 나무있는 곳, 지혜의 호수 옆에That's a fairy tail. I've run all over this island.그건 동화에서나 나오는 거야. 내가 이섬을 모두 돌아봤.. 더보기
[Raspberry Pi] Node.js 설치하기 Raspberry Pi 2에 Node.js를 설치하는 방법 1. Node.js 설치를 위해 /etc/apt/source.list에 apt.adafruit.com package reposity를 추가한다.curl -sLS https://apt.adafruit.com/add | sudo bash 2. apt-get 명령어를 이용하여 node를 설치한다.sudo apt-get install node 3. node -v 명령어로 설치된 node.js의 버전을 확인한다. 현재 버전은 0.12.0이 최신버전이다.pi@wj-pi ~ $ node -v v0.12.0 더보기
[Raspberry Pi] WebIOPi 설치 방법 1) wget을 이용하여 파일 다운로드$ wget http://sourceforge.net/projects/webiopi/files/WebIOPi-0.7.1.tar.gz WebIOPi 의 버전은 최신버전에 맞게 수정해서 다운로드 받으면 됨 2) 압축 해제$ tar -xvzf WebIOPi-0.7.1.tar.gz 3) 설치$ cd WebIOPi-0.7.1$ sudo ./setup.sh 4) 실행도움말이 필요하면 아래와 같이...$ sudo webiopi -hWebIOPi command-line usagewebiopi [-h] [-c config] [-l log] [-s script] [-d] [port]Options: -h, --help Display this help -c, --config file Lo.. 더보기