![](/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: Comm/Comm.cpp
- Revision:
- 11:711d3c207e8c
- Parent:
- 10:769cc457c3a4
- Child:
- 14:d620415259b1
diff -r 769cc457c3a4 -r 711d3c207e8c Comm/Comm.cpp --- a/Comm/Comm.cpp Sat Dec 05 09:04:23 2015 +0000 +++ b/Comm/Comm.cpp Tue Dec 08 22:52:46 2015 +0000 @@ -3,7 +3,7 @@ Comm::Comm(CommDelegate *controls):_pc(USBTX, USBRX), _json(&_pc) { - _pc.baud(9600); + _pc.baud(115200); _controls = controls; } @@ -106,14 +106,14 @@ _json.close(); } -void Comm::setTorque(Arguments * input, Reply * output){ +void Comm::setTheta(Arguments * input, Reply * output){ if (input->argc < 1){ throwNotEnoughArgsError(); return; } - float torque = input->getArg<float>(); - _pc.printf("%f\n", torque); - _controls->setTorque(torque); + float theta = input->getArg<float>(); + _pc.printf("%f\n", theta); + _controls->setTheta(theta); } void Comm::printPosition(){ @@ -128,6 +128,14 @@ _json.close(); } +void Comm::printVelocity(){ + _json.open(); + _json.print("dth1", _controls->getDTheta1()); + _json.sepItem(); + _json.print("dth2", _controls->getDTheta2()); + _json.close(); +} + void Comm::check(){ if(!_pc.readable()) return; _pc.gets(buf, 256);