Working with RPC Variables
Dependencies: RPCInterface mbed
main.cpp
00001 #include "mbed.h" 00002 #include "mbed_rpc.h" 00003 00004 // These are examples of some variable types that can be modified through RPC. 00005 int wheelsOn; 00006 char lcdBannerMessage; 00007 float speed; 00008 00009 RPCVariable<int> rpcLights(&wheelsOn, "wheels"); 00010 RPCVariable<char> rpcBanner(&lcdBannerMessage, "banner"); 00011 RPCVariable<float> rpcSpeed(&speed, "speed"); 00012 00013 Serial pc(USBTX, USBRX); 00014 00015 int main() { 00016 //The mbed RPC classes are now wrapped to create an RPC enabled version - see RpcClasses.h so don't add to base class 00017 00018 // receive commands, and send back the responses 00019 char buf[256], outbuf[256]; 00020 while(1) { 00021 pc.gets(buf, 256); 00022 //Call the static call method on the RPC class 00023 RPC::call(buf, outbuf); 00024 pc.printf("%s\n", outbuf); 00025 } 00026 }
Generated on Wed Jul 13 2022 21:02:21 by
1.7.2