Node.js ♡ Hardwares w/ node-serialport

10
2012.11.18 @ 東京Node学園祭 Node.js ♡ Hardwares w/ node-serialport Yusuke Umahashi / @niccolli

description

at 東京Node学園祭2012 Webブラウザからハードウェアを動かす話をしました 詳細はこちらで http://log.niccol.li/2012/10/nodejsxbeeiphonearduino.html http://log.niccol.li/2012/11/iphonearduinoxbeenodejs2.html

Transcript of Node.js ♡ Hardwares w/ node-serialport

Page 1: Node.js ♡ Hardwares w/ node-serialport

2012.11.18 @ 東京Node学園祭

Node.js ♡ Hardwaresw/ node-serialportYusuke Umahashi / @niccolli

Page 2: Node.js ♡ Hardwares w/ node-serialport

>>> http://LED.local/ <<<

✤ @niccolli / Yusuke Umahashi

✤ なごやのほうからきました

✤ 組み込みハードウェアの設計

✤ JS / C / Objective-C / Perl

✤ Arduino / Bluetooth LE ZigBee

はじめまして

Page 3: Node.js ♡ Hardwares w/ node-serialport

>>> http://LED.local/ <<<

さっそく実演

✤ アドベントカレンダーの内容を踏まえて

✤ iPhoneとArduinoをNode.jsでつなぐ

✤ → http://LED.local/ ←

Page 4: Node.js ♡ Hardwares w/ node-serialport

>>> http://LED.local/ <<<

前回のおさらい

✤ 基調講演@東京Node学園祭2011

✤ Node.jsの名前の由来「グラフ理論のノードから」

✤ 「Nodeを節点にしたネットワークに期待」

http://gihyo.jp/news/report/2011/11/0402

Page 5: Node.js ♡ Hardwares w/ node-serialport

>>> http://LED.local/ <<<

node-serialport

✤ シリアル通信をNode向けに抽象化

✤ 受信

✤ serial.on(‘data’, function(data){ … });

✤ 送信

✤ serial.write(values);

Page 6: Node.js ♡ Hardwares w/ node-serialport

>>> http://LED.local/ <<<

Nodeをノードとして

Node.js

WebSocket(Socket.IO)

node-serialport

Page 7: Node.js ♡ Hardwares w/ node-serialport

>>> http://LED.local/ <<<

XBeeで無線通信

✤ ZigBee規格を抽象化したボード

✤ センサネットワーク向け

✤ 入出力はシリアル通信

✤ node-xbee

✤ node-serialportを拡張 http://www.switch-science.com/products/detail.php?product_id=1081

Page 8: Node.js ♡ Hardwares w/ node-serialport

>>> http://LED.local/ <<<

仕組み

Node.js

WebSocket(Socket.IO)

node-xbee

シリアル通信

Page 9: Node.js ♡ Hardwares w/ node-serialport

>>> http://LED.local/ <<<

iPhoneと外部ハードウェア

✤ 今まで

✤ Made For iPod/iPhoneシリーズのみ

✤ Dockコネクタは要JB

✤ イヤホンジャック

✤ Redpark

Page 10: Node.js ♡ Hardwares w/ node-serialport

>>> http://LED.local/ <<<

iPhoneと外部ハードウェア

✤ これから

✤ イヤホンジャック

✤ Bluetooth LE

✤ WebSocket + Node