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 Ryo Iizuka

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.

/media/uploads/nyatla/--_2.png

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

Reference

日本語

MiMicProject http://nyatla.jp/mimic/wp/

mbedJSはmbedをWebネットワークにつなぐためのアプリケーションです。 Javascript(ウェブブラウザ)、Processing、Javaから、mbedを操作することができます。 これらはmbedSDKのクラスライブラリとよく似たAPIなので、mbedを知っている方なら簡単に使うことができます。

/media/uploads/nyatla/--_2.png

特徴

  • 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

ドキュメント

関連記事

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;
 }