bio robot

Dependencies:   MPU6050-DMP QEI_hw mbed-rpc mbed

Fork of MPU6050_Example by Shundo Kishi

Committer:
amandaghassaei
Date:
Thu Dec 03 03:01:37 2015 +0000
Revision:
3:be5cf450436d
Parent:
2:17b18ea93551
Child:
4:ebb882658c50
starting to add in rpc;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
amandaghassaei 3:be5cf450436d 1 #include "mbed.h"
amandaghassaei 3:be5cf450436d 2 #include "mbed_rpc.h"
syundo0730 0:8d2c753a96e7 3
amandaghassaei 2:17b18ea93551 4 #include "MyMPU6050.h"
amandaghassaei 2:17b18ea93551 5 #include "Gains.h"
amandaghassaei 2:17b18ea93551 6 #include "Target.h"
syundo0730 0:8d2c753a96e7 7
amandaghassaei 2:17b18ea93551 8 #include "Comm.h"
syundo0730 0:8d2c753a96e7 9
amandaghassaei 3:be5cf450436d 10 void ReadRange(Arguments* input, Reply* output);
amandaghassaei 3:be5cf450436d 11 RPCFunction RangeFinder(&ReadRange, "RangeFinder");
amandaghassaei 3:be5cf450436d 12
amandaghassaei 3:be5cf450436d 13 Serial pc(USBTX, USBRX);
syundo0730 0:8d2c753a96e7 14
amandaghassaei 2:17b18ea93551 15 Gains gains;
amandaghassaei 2:17b18ea93551 16 Target target;
syundo0730 0:8d2c753a96e7 17
amandaghassaei 2:17b18ea93551 18 MyMPU6050 myMPU6050_1(p9, p10);//I2C_SDA, I2C_SCL
syundo0730 0:8d2c753a96e7 19
amandaghassaei 2:17b18ea93551 20 Comm comm(&gains, &target, &myMPU6050_1);
syundo0730 0:8d2c753a96e7 21
syundo0730 0:8d2c753a96e7 22 int main() {
amandaghassaei 3:be5cf450436d 23 char buf[256], outbuf[256];
syundo0730 0:8d2c753a96e7 24 while(1) {
amandaghassaei 2:17b18ea93551 25 myMPU6050_1.loop();
amandaghassaei 2:17b18ea93551 26 // comm.printTarget();
amandaghassaei 3:be5cf450436d 27
amandaghassaei 3:be5cf450436d 28 pc.gets(buf, 256);
amandaghassaei 3:be5cf450436d 29 //Call the static call method on the RPC class
amandaghassaei 3:be5cf450436d 30 RPC::call(buf, outbuf);
amandaghassaei 3:be5cf450436d 31 pc.printf("%s\n", outbuf);
syundo0730 0:8d2c753a96e7 32 }
syundo0730 0:8d2c753a96e7 33 }
syundo0730 0:8d2c753a96e7 34
amandaghassaei 3:be5cf450436d 35 void ReadRange(Arguments* input, Reply* output){
amandaghassaei 3:be5cf450436d 36 for (int i=0; i < input->argc; i++){
amandaghassaei 3:be5cf450436d 37 pc.printf("argv[%1d] = %s \n",i,input->argv[i]);
amandaghassaei 3:be5cf450436d 38 }
amandaghassaei 3:be5cf450436d 39
amandaghassaei 3:be5cf450436d 40 pc.printf("amandaasdffasdfads");
amandaghassaei 3:be5cf450436d 41 //Format the output of the srf08 into the output string
amandaghassaei 3:be5cf450436d 42 // sprintf(output, "%f", srf08.read());
amandaghassaei 3:be5cf450436d 43 }
syundo0730 0:8d2c753a96e7 44