A RPC example usage program.

Dependencies:   mbed-rpc mbed

Fork of RPC_Serial by Michael Walker

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "mbed_rpc.h"
00003 
00004 /**
00005  *  This example program has been updated to use the RPC implementation in the new mbed libraries.
00006  *  This example shows the uses of the RPCDigitalOut wrapper class
00007  */
00008 
00009 //Use the RPC enabled wrapped class  - see RpcClasses.h for more info
00010 RpcDigitalOut mbedled(LED1,"mbedled");
00011 RpcDigitalIn     sw(p8, "switch");
00012 RpcPwmOut       led(p21, "pwmled");
00013 Serial pc(USBTX, USBRX);
00014 
00015 int main() {
00016 
00017     char buf[256], outbuf[256];
00018     while(1) {
00019         pc.gets(buf, 256);
00020         //Call the static call method on the RPC class
00021         RPC::call(buf, outbuf); 
00022         pc.printf("%s\n", outbuf);
00023     }
00024 }