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@6:cb40d6349b96, 2016-03-15 (annotated)
- Committer:
- dhcabinian
- Date:
- Tue Mar 15 05:10:51 2016 +0000
- Revision:
- 6:cb40d6349b96
- Parent:
- 5:59421f613a13
- Child:
- 7:d72b60abcab5
Readded Analogin and PWMout;
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 | 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 | 6:cb40d6349b96 | 11 | RpcAnalogIn 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 | } |
