A demonstration of RPC object instantiation.
Fork of RPC_DigitalInDigitalOutPWMOutoverSerial by
main.cpp
- Committer:
- dhcabinian
- Date:
- 2016-03-12
- Revision:
- 4:d69dfbef9644
- Parent:
- 3:4ddd10908e46
- Child:
- 5:59421f613a13
File content as of revision 4:d69dfbef9644:
#include "mbed.h" #include "mbed_rpc.h" /** * This example program has been updated to use the RPC implementation in the new mbed libraries. * This example demonstrates using RPC over serial with DigitalOut, DigitalIn, and PWMOut usages */ //Use the RPC enabled wrapped class - see RpcClasses.h for more info RpcDigitalOut myled(LED4,"mbedled"); RpcDigitalIn swIn(p8, "switchIn"); RpcPwmOut led(p21, "pwmled"); Serial pc(USBTX, USBRX); int main() { //The mbed RPC classes are now wrapped to create an RPC enabled version - see RpcClasses.h so don't add to base class // receive commands, and send back the responses char buf[256], outbuf[256]; while(1) { pc.gets(buf, 256); //Call the static call method on the RPC class RPC::call(buf, outbuf); pc.printf("%s\n", outbuf); } }