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@3:726cfc72fe9a, 2014-06-20 (annotated)
- Committer:
- bhavik
- Date:
- Fri Jun 20 13:14:44 2014 +0000
- Revision:
- 3:726cfc72fe9a
- Parent:
- 2:fadccef926e4
- Child:
- 4:726b4e996614
made changes according to the new mbed-rpc library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| MichaelW | 0:78952cd3935b | 1 | #include "mbed.h" |
| bhavik | 3:726cfc72fe9a | 2 | #include "mbed_rpc.h" |
| bhavik | 2:fadccef926e4 | 3 | |
| MichaelW | 0:78952cd3935b | 4 | Serial pc(USBTX, USBRX); |
| bhavik | 2:fadccef926e4 | 5 | |
| MichaelW | 0:78952cd3935b | 6 | int main() { |
| MichaelW | 1:de34af25056a | 7 | // setup the classes that can be created dynamically |
| bhavik | 3:726cfc72fe9a | 8 | /*RPC::add_rpc_class<AnalogIn>(); |
| bhavik | 3:726cfc72fe9a | 9 | //RPC::add_rpc_class<AnalogOut>(); |
| bhavik | 3:726cfc72fe9a | 10 | RPC::add_rpc_class<DigitalIn>(); |
| bhavik | 3:726cfc72fe9a | 11 | RPC::add_rpc_class<DigitalOut>(); |
| bhavik | 3:726cfc72fe9a | 12 | RPC::add_rpc_class<DigitalInOut>(); |
| bhavik | 3:726cfc72fe9a | 13 | RPC::add_rpc_class<PwmOut>(); |
| bhavik | 3:726cfc72fe9a | 14 | RPC::add_rpc_class<Timer>(); |
| bhavik | 3:726cfc72fe9a | 15 | RPC::add_rpc_class<SPI>(); |
| bhavik | 3:726cfc72fe9a | 16 | RPC::add_rpc_class<BusOut>(); |
| bhavik | 3:726cfc72fe9a | 17 | RPC::add_rpc_class<BusIn>(); |
| bhavik | 3:726cfc72fe9a | 18 | RPC::add_rpc_class<BusInOut>(); |
| bhavik | 3:726cfc72fe9a | 19 | RPC::add_rpc_class<Serial>();*/ |
| bhavik | 3:726cfc72fe9a | 20 | |
| bhavik | 3:726cfc72fe9a | 21 | RPC::add_rpc_class<RpcDigitalIn>(); |
| bhavik | 3:726cfc72fe9a | 22 | |
| MichaelW | 1:de34af25056a | 23 | // receive commands, and send back the responses |
| bhavik | 3:726cfc72fe9a | 24 | char buf[256], outbuf[256]; |
| bhavik | 3:726cfc72fe9a | 25 | |
| MichaelW | 0:78952cd3935b | 26 | while(1) { |
| MichaelW | 0:78952cd3935b | 27 | pc.gets(buf, 256); |
| bhavik | 3:726cfc72fe9a | 28 | RPC::call(buf, outbuf); |
| MichaelW | 0:78952cd3935b | 29 | pc.printf("%s\n", outbuf); |
| MichaelW | 0:78952cd3935b | 30 | } |
| MichaelW | 0:78952cd3935b | 31 | } |
