This is a Json-RPC/2.0 server with websocket and httpd. You can control mbed(s) by Javascript, processing, Java. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088
Dependencies: NyFileSystems libMiMic mbed-rtos mbed
Fork of MiMicRemoteMCU-for-Mbed by
You are viewing an older revision! See the latest version
Homepage
Websocketでmbedをコントロールするためのアプリケーションです。 基本的な使い方はMiMicRemoteMCUと同じですがJavascriptAPIが違います。
ブラウザで利用できるエディタ、API、その他諸々の機能をファームウェア単体で提供します。 mbed標準のRPCと比較して高速に動作します。
ベータ版です。 バグやごしつもんはtwitterアカウント@nyatlaまでお願いします。
記事とか
- エェェェェンベッドJS (mbedJS) beta版をリリースしました http://nyatla.hatenadiary.jp/entry/20140625/1403701589 - javascriptAPI http://mimic.sourceforge.jp/doc/mbedjs/current/
ロードマップ
サンプルコード
JavascriptでLチカをした場合のサンプルコードです。コールバックとGenerator(ES6以降に対応)の2通りの書き方ができます。
callback mode
function start() { var mcu=new mbedJS.Mcu(location.host,{ onNew:function(){ var v=1; var pin=new mbedJS.DigitalOut(mcu,mbedJS.PinName.LED1,{ onNew:function(){ pin.write(1); }, onWrite:function(){ setTimeout(function(){pin.write((v++)%2);},100); }}); }, onError:function(){alert("Error!");} }); }
generator mode
function start() { var g=function*(){ try{ var mcu=new mbedJS.Mcu(location.host,g); yield mcu.waitForNew(); var pin=new mbedJS.DigitalOut(mcu,mbedJS.PinName.LED1,g); yield pin.waitForNew(); for(var v=1;;v++){ yield setTimeout(function(){g.next();},100); yield pin.write(v%2); } }catch(e){ mcu.shutdown(); alert(e); throw e; } }(); g.next(); return; }