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
English
MiMicProject http://nyatla.jp/mimic/wp/
This application allow to control the remote mbed through the network. It allows to control the mbed without a firmware update. It has some Interface. There are Javascript(WebBrowser), Procesing, Java. API waits for a function very similar to mbedSDK.
Feature
- Low delay RPC by Websocket+JSON-RPC.
- OnChip programing environment (Javascript).
- Zero configuration support (UPnP/mDNS/AutoIP/DHCP)
- mbedAPI like APIs.
- Supports mbed LPC1768/LPCXpresso1769/LPC4088/FRDM-K64F
GettingStarted
mbed(LPC1768)
- Compile and write mbedJS to your mbed.
- Create mimic.cfg file to the mbed drive. This is network configuration.
- Connect to Ethernet cable to the mbed.
- Reset mbed.
- Open http://[mbed IP address]/ by web browser.
- Click JavascriptEditor.
- Click StartButton. LED will be blinking.
LPCXpresso1769 and LPC4088 QuickStartBoard and FRDM-K64F
Those do not have LocalFileSystem. mbedJS initial IP address is "192.168.0.39". Open this address and click Setup page. You can change ipaddress at here.
Other APIs
- mbedJS Javascript API https://github.com/nyatla/mbedJS-Javascript-API
- mbedJS Java API https://github.com/nyatla/mbedJS-Java-API
- mbedJS processing API https://github.com/nyatla/mbedJS-Processing-API
Reference
- QuickStart manual http://mimic.sourceforge.jp/doc/pdf/mbedJS.quickstart.en.pdf
- javascriptAPI referencehttp://mimic.sourceforge.jp/doc/mbedjs/current/
- javascriptAPI driver referencehttp://mimic.sourceforge.jp/doc/mbedjs.driver/current/
- http://mbed.org/users/nyatla/notebook/how-to-control-mbed-from-processing/
日本語
MiMicProject http://nyatla.jp/mimic/wp/
mbedJSはmbedをWebネットワークにつなぐためのアプリケーションです。 Javascript(ウェブブラウザ)、Processing、Javaから、mbedを操作することができます。 これらはmbedSDKのクラスライブラリとよく似たAPIなので、mbedを知っている方なら簡単に使うことができます。
特徴
- Websocket+JSONRPCによる低遅延なRPC
- ワンチップでブラウザ向けの開発環境を提供
- UPnP/Bonjurによるディスカバりに対応
- mbedSDKのAPIと同じ構成のAPI
- mbed LPC1768/LPCXpresso1769/LPC4088/FRDM-K64Fに対応
このアプリケーションはMiMicRemoteMCUとよく似ていますが、JavascriptAPIがより使いやすくなりました。
はじめかた
- ファームウェアをmbedに書き込みます。
- 設定ファイルにネットワークに合わせたIPアドレスを指定します。
- mbedをリセットして、設定したIPアドレスをブラウザで開きます。
- JavascriptEditorを開きます。
- Startボタンを押してLEDがチカチカすれば成功です。
mbedJS APIs
- mbedJS Javascript API https://github.com/nyatla/mbedJS-Javascript-API
- mbedJS Java API https://github.com/nyatla/mbedJS-Java-API
- mbedJS processing API https://github.com/nyatla/mbedJS-Processing-API
ドキュメント
- クイックスタートマニュアル http://mimic.sourceforge.jp/doc/pdf/mbedJS.quickstart.ja.pdf
- javascriptAPIリファレンス http://mimic.sourceforge.jp/doc/mbedjs/current/
- javascriptAPIリファレンス(ドライバ) http://mimic.sourceforge.jp/doc/mbedjs.driver/current/
関連記事
- MiMicProject http://nyatla.jp/mimic/wp/
- mbedJS + p5.jsでWebブラウザからmbedを制御するhttp://nyatla.hatenadiary.jp/entry/20141103/1415021260
- エェェェェンベッドJS (mbedJS) beta版をリリースしました http://nyatla.hatenadiary.jp/entry/20140625/1403701589
- ProcessingとJavaからmbedを操作して遊べるようにした http://nyatla.hatenadiary.jp/entry/20140720/1405861733
- mbedJSをインターネットで共有するシステムを作ったhttp://nyatla.hatenadiary.jp/entry/20140912/1410528645
Diff: main.cpp
- Revision:
- 28:3d7bac2a6278
- Parent:
- 27:a3b49b4a814d
- Child:
- 33:8e869201db67
--- a/main.cpp Thu Jul 18 08:54:13 2013 +0000 +++ b/main.cpp Fri Aug 09 09:06:45 2013 +0000 @@ -11,6 +11,8 @@ LocalFileSystem2 lf("local"); SDFileSystem sd(p5, p6, p7, p8,"sd"); +Net* net; + /** * MiMic RemoteMCU httpd.<br/> @@ -30,17 +32,22 @@ ModRemoteMcu remotemcu; // remotemcu API ModLocalFileSystem modlocal; //FileSystem mounter ModLocalFileSystem modsd; //FileSystem mounter - ModFileIo modfio; //fileupload API + ModFileIo modfio; //fileupload API + ModUPnPDevice modupnp; public: - MiMicRemoteMcu(NetConfig& i_cfg):Httpd(i_cfg._inst.services.http_port) + MiMicRemoteMcu(NetConfig& i_cfg):Httpd(i_cfg.getHttpPort()) { - this->modromfs.setParam("rom",RMCU_FSDATA,17); + this->modromfs.setParam("rom",RMCU_FSDATA,18); this->mimicsetting.setParam("setup"); this->remotemcu.setParam("mvm"); this->modlocal.setParam("local"); - this->modsd.setParam("sd"); + this->modsd.setParam("sd",ModLocalFileSystem::FST_SDFATFS); this->modfio.setParam("fio"); + this->modupnp.setParam(*net); } + /** + * Http handler + */ virtual void onRequest(HttpdConnection& i_connection) { //try to ModRomFS module. @@ -67,6 +74,10 @@ if(this->modfio.execute(i_connection)){ return; } + //try to UPnP + if(this->modupnp.execute(i_connection)){ + return; + } //Otherwise, Send the redirect response to /rom/index.html i_connection.sendHeader(302, @@ -77,17 +88,25 @@ } }; + +NetConfig cfg; //create network configulation with onchip-setting. int main() { - NetConfig cfg; //create network configulation with onchip-setting. - Net net; //create a net instance + net=new Net();//Net constructor must be created after started RTOS + //Prepare configulation. + cfg.setUPnPIcon(64,64,8,"image/png","/rom/icon.png"); + cfg.setUPnPUdn(0xe29f7101,0x4ba2,0x01e0,0); + cfg.setFriendlyName("MiMicRemoteMCU"); + cfg.setUPnPPresentationURL("/rom/index.html"); + //try to override setting by local file. if(!cfg.loadFromFile("/local/mimic.cfg")){ Thread::wait(2000);//wait for SD card initialization. cfg.loadFromFile("/sd/mimic.cfg"); } + MiMicRemoteMcu httpd(cfg); //create a httpd instance. - net.start(cfg); + net->start(cfg); httpd.loop(); //start httpd loop. return 0; }