A RPC example usage program.

Dependencies:   mbed-rpc mbed

Fork of RPC_Serial by Michael Walker

Committer:
dhcabinian
Date:
Tue Mar 15 05:11:46 2016 +0000
Revision:
7:d72b60abcab5
Parent:
6:cb40d6349b96
Changed from AnalogIN to DigitalIn;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MichaelW 0:78952cd3935b 1 #include "mbed.h"
MichaelW 2:37712731e13d 2 #include "mbed_rpc.h"
MichaelW 2:37712731e13d 3
MichaelW 3:4ddd10908e46 4 /**
MichaelW 3:4ddd10908e46 5 * This example program has been updated to use the RPC implementation in the new mbed libraries.
dhcabinian 6:cb40d6349b96 6 * This example shows the uses of the RPCDigitalOut wrapper class
MichaelW 3:4ddd10908e46 7 */
MichaelW 2:37712731e13d 8
MichaelW 2:37712731e13d 9 //Use the RPC enabled wrapped class - see RpcClasses.h for more info
dhcabinian 6:cb40d6349b96 10 RpcDigitalOut mbedled(LED1,"mbedled");
dhcabinian 7:d72b60abcab5 11 RpcDigitalIn sw(p8, "switch");
dhcabinian 6:cb40d6349b96 12 RpcPwmOut led(p21, "pwmled");
MichaelW 0:78952cd3935b 13 Serial pc(USBTX, USBRX);
dhcabinian 5:59421f613a13 14
MichaelW 0:78952cd3935b 15 int main() {
dhcabinian 5:59421f613a13 16
MichaelW 0:78952cd3935b 17 char buf[256], outbuf[256];
MichaelW 0:78952cd3935b 18 while(1) {
MichaelW 0:78952cd3935b 19 pc.gets(buf, 256);
MichaelW 2:37712731e13d 20 //Call the static call method on the RPC class
MichaelW 2:37712731e13d 21 RPC::call(buf, outbuf);
MichaelW 0:78952cd3935b 22 pc.printf("%s\n", outbuf);
MichaelW 0:78952cd3935b 23 }
dhcabinian 4:d69dfbef9644 24 }