
http://mbed.org/users/okini3939/notebook/RPC_jp/
Diff: main.cpp
- Revision:
- 0:9b9a9bfadf9b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Jun 05 02:20:50 2012 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +#include "rpc.h" +#include "MyRPC.h" + +Serial pc(USBTX, USBRX); + +int main() { + // setup the classes that can be created dynamically + Base::add_rpc_class<MyRPC>(); + + // receive commands, and send back the responses + char buf[256], outbuf[256]; + while(1) { + pc.gets(buf, 256); + rpc(buf, outbuf); + pc.printf("%s\n", outbuf); + } +}