Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of RPC_Serial_new by
main.cpp
00001 #include "mbed.h" 00002 #include "mbed_rpc.h" 00003 00004 Serial pc(USBTX, USBRX); 00005 00006 int main() { 00007 // setup the classes that can be created dynamically 00008 RPC::add_rpc_class<RpcAnalogIn>(); 00009 00010 RPC::add_rpc_class<RpcDigitalIn>(); 00011 RPC::add_rpc_class<RpcDigitalOut>(); 00012 00013 RPC::add_rpc_class<RpcPwmOut>(); 00014 00015 RpcAnalogIn rpc_ain(p19, "ain"); 00016 RpcDigitalOut rpc_led(LED1, "led"); 00017 RpcPwmOut rpc_pwmout(p10, "pwmout"); 00018 00019 // receive commands, and send back the responses 00020 char buf[256], outbuf[256]; 00021 00022 while(1) { 00023 pc.gets(buf, 256); 00024 RPC::call(buf, outbuf); 00025 pc.printf("%s\n", outbuf); 00026 } 00027 } 00028 /* 00029 void myRPCAnalogIn(Arguments* input, Reply* output){ 00030 output->putData(ain.read()); 00031 led3 = 1; 00032 wait(2); 00033 led3 = 0; 00034 } 00035 */
Generated on Sun Jul 17 2022 05:03:13 by
1.7.2
