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 by
main.cpp@2:37712731e13d, 2014-08-14 (annotated)
- Committer:
- MichaelW
- Date:
- Thu Aug 14 09:08:44 2014 +0000
- Revision:
- 2:37712731e13d
- Parent:
- 1:de34af25056a
- Child:
- 3:4ddd10908e46
Intial Commit of RPC over serial updated to the new RPC implementation on mbed
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| MichaelW | 0:78952cd3935b | 1 | #include "mbed.h" |
| MichaelW | 2:37712731e13d | 2 | #include "mbed_rpc.h" |
| MichaelW | 2:37712731e13d | 3 | |
| MichaelW | 2:37712731e13d | 4 | //This example program as been updated to use the RPC implementation in the new mbed libraries. |
| MichaelW | 2:37712731e13d | 5 | |
| MichaelW | 2:37712731e13d | 6 | //Use the RPC enabled wrapped class - see RpcClasses.h for more info |
| MichaelW | 2:37712731e13d | 7 | RpcDigitalOut myled(LED4,"myled"); |
| MichaelW | 2:37712731e13d | 8 | |
| MichaelW | 0:78952cd3935b | 9 | Serial pc(USBTX, USBRX); |
| MichaelW | 0:78952cd3935b | 10 | int main() { |
| MichaelW | 2:37712731e13d | 11 | //The mbed RPC classes are now wrapped to create an RPC enabled version - see RpcClasses.h so no longer any need to add them to the base class |
| MichaelW | 2:37712731e13d | 12 | |
| MichaelW | 1:de34af25056a | 13 | // receive commands, and send back the responses |
| MichaelW | 0:78952cd3935b | 14 | char buf[256], outbuf[256]; |
| MichaelW | 0:78952cd3935b | 15 | while(1) { |
| MichaelW | 0:78952cd3935b | 16 | pc.gets(buf, 256); |
| MichaelW | 2:37712731e13d | 17 | //Call the static call method on the RPC class |
| MichaelW | 2:37712731e13d | 18 | RPC::call(buf, outbuf); |
| MichaelW | 0:78952cd3935b | 19 | pc.printf("%s\n", outbuf); |
| MichaelW | 0:78952cd3935b | 20 | } |
| MichaelW | 0:78952cd3935b | 21 | } |
