![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
bio robot
Dependencies: MPU6050-DMP QEI_hw mbed-rpc mbed
Fork of MPU6050_Example by
Diff: main.cpp
- Revision:
- 3:be5cf450436d
- Parent:
- 2:17b18ea93551
- Child:
- 4:ebb882658c50
--- a/main.cpp Thu Dec 03 02:23:34 2015 +0000 +++ b/main.cpp Thu Dec 03 03:01:37 2015 +0000 @@ -1,43 +1,44 @@ +#include "mbed.h" +#include "mbed_rpc.h" #include "MyMPU6050.h" #include "Gains.h" #include "Target.h" #include "Comm.h" -#include "SerialRPCInterface.h" +void ReadRange(Arguments* input, Reply* output); +RPCFunction RangeFinder(&ReadRange, "RangeFinder"); + +Serial pc(USBTX, USBRX); Gains gains; Target target; MyMPU6050 myMPU6050_1(p9, p10);//I2C_SDA, I2C_SCL -SerialRPCInterface RPC(USBTX, USBRX); - -DigitalOut myled(LED1); -DigitalOut myled2(LED2); - -volatile bool ledstate = 1; -void ReadRange(char * input, char * output); -void ReadRange(char * input, char * output){ - //Format the output of the srf08 into the output string - ledstate = 0; - myled = 0; -// comm.printTarget(); -// output = "amanda"; -} -RPCFunction RangeFinder2(&ReadRange, "RangeFinder"); - Comm comm(&gains, &target, &myMPU6050_1); int main() { - myled = 1; + char buf[256], outbuf[256]; while(1) { myMPU6050_1.loop(); - myled2 = ledstate; // comm.printTarget(); + + pc.gets(buf, 256); + //Call the static call method on the RPC class + RPC::call(buf, outbuf); + pc.printf("%s\n", outbuf); } } +void ReadRange(Arguments* input, Reply* output){ + for (int i=0; i < input->argc; i++){ + pc.printf("argv[%1d] = %s \n",i,input->argv[i]); + } + + pc.printf("amandaasdffasdfads"); + //Format the output of the srf08 into the output string +// sprintf(output, "%f", srf08.read()); +} -