http://mbed.org/users/okini3939/notebook/RPC_jp/

Dependencies:   mbed

main.cpp

Committer:
okini3939
Date:
2012-06-05
Revision:
0:9b9a9bfadf9b

File content as of revision 0:9b9a9bfadf9b:

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