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

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "rpc.h"
00003 #include "MyRPC.h"
00004 
00005 Serial pc(USBTX, USBRX);
00006 
00007 int main() {
00008     // setup the classes that can be created dynamically
00009     Base::add_rpc_class<MyRPC>();
00010 
00011     // receive commands, and send back the responses
00012     char buf[256], outbuf[256];
00013     while(1) {
00014         pc.gets(buf, 256);
00015         rpc(buf, outbuf); 
00016         pc.printf("%s\n", outbuf);
00017     }
00018 }