Quick Test Hack of the RPCInterface lib - it works for me!!
Dependencies: RPCInterface mbed
Fork of RPC_RangeFinderDemo by
Diff: main.cpp
- Revision:
- 2:9a7f340bf830
- Parent:
- 1:e5e4988258b9
- Child:
- 3:29986d0e80da
--- a/main.cpp Fri Feb 04 11:13:28 2011 +0000 +++ b/main.cpp Wed Dec 19 10:44:10 2012 +0000 @@ -4,7 +4,7 @@ */ #include "mbed.h" #include "SerialRPCInterface.h" -#include "SRF08.h" + using namespace mbed; @@ -12,7 +12,7 @@ SerialRPCInterface RPC(USBTX, USBRX); void ReadRange(char * input, char * output); RPCFunction RangeFinder(&ReadRange, "RangeFinder"); -SRF08 srf08(p9, p10, 0xE0); // Define SDA, SCL pin and I2C address +//SRF08 srf08(p9, p10, 0xE0); // Define SDA, SCL pin and I2C address DigitalOut myled(LED1); int main() { @@ -30,5 +30,21 @@ //As neither I2C nor the SRF08 library is avalible directly over RPC we create a Custom Function which we make RPCable by attaching to an RPCFunction void ReadRange(char * input, char * output){ //Format the output of the srf08 into the output string - sprintf(output, "%f", srf08.read()); +// sprintf(output, "%f", srf08.read()); } + + +/* Code Frags +#include "RPCFunction.h" +void setTime(char * input, char * output); +RPCFunction rpc_setTime(&setTime, "setTime"); + +void setTime(char * input, char * output){ + int hours,mins,secs; + sscanf(input, "%i,%i,%i", &hours, &mins, &secs); + + //Use the hours, mins, secs variables to set the time here + + sprintf(ouput, "Anything you want to output here - you don't really need it"); + +*/ \ No newline at end of file