edy555 / zeemote-sample Goto Github PK
View Code? Open in Web Editor NEWSample project of Zeemote + WebSocket + WebGL(Three.js)
Sample project of Zeemote + WebSocket + WebGL(Three.js)
== Zeemote + WebSocket + WebGL(three.js) == edy555 _at_ gmail.com 2/13/2012 * 概要 Zeemote, WebSocket, three.jsを使ったサンプルです。 MacBook Proで動作します。その他のプラットフォームの場合は、 Bluetoothとの接続部分に改造が必要だと思います。 Zeemote(ジョイスティックモード)はプロファイルとしてSPPを持ったBluetooth デバイスです。Zeemoteを操作すると、バイナリメッセージを送ってきます。 メッセージフォーマットはシンプルですので、これをRuby+EventMachine によるサーバにより解釈して、WebSocketのメッセージとして送信します。 ブラウザでは、WebGL+Three.jsによりモデルを表示し、スティック操作で 動くようにしてみました。 * 準備 $ gem install eventmachine $ gem install em-websocket * ペアリング ZeemoteのDボタン(親指)を長押しして電源を入れる(LEDが点滅する) Set Up Bluetooth Device... からBluetooth Setup Assistantを 開き、"Zeemote JS1 H"を選択してペアリングする。 ペアリングが完了すると、/dev/tty.ZeemoteJS1H-ZeemoteSPP という デバイスノードが作られているはずです。 もしZeemoteが別のモード(キーボードもしくはマウスモード)になっている 場合は、電源を入れる際にCボタンを押しながら、Dボタンを長押ししてください。 詳しくは取り扱い説明書を参照してください。 * サーバを起動する $ ruby ./server.rb Zeemoteとの接続が確立すると、スティックやボタンを操作するとメッセージが 流れていきます。 Zeemoteの電源が切れている場合、エラーが発生するので、LEDの点滅を確認すること。 * ページを開く Chromeでindex.htmlを開くとトーラスが表示されます。 WebSocketサーバとの接続が成功している場合は、サーバ側に"connected"と 表示され、Zeemoteのスティック操作で角度がぐりぐり変化します。 * 注意 BluetoothならびにWebSocketの再接続を実装していないので、Zeemoteの電源、 サーバの起動、ページの表示(リロード)の順序で行う必要があります。 * 参考 Zeemote JS1 H 取扱説明書 http://www.aplix.co.jp/zeemote/jp/js1h/Zeemote-JS1H-manual-JP.pdf #devfestxj「WebGL & three.js 最新の話題 ライブラリ紹介」講演スライド http://webos-goodies.jp/attachments/devfestx_sapporo_2012_webgl 橋本商会 EventMachine::WebSocketでチャットを作る http://shokai.org/blog/archives/5434 EOF
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.