Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
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までお願いします。
紹介記事
記事書きました。http://nyatla.hatenadiary.jp/entry/20140625/1403701589
ロードマップ
サンプルコード
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; }