NHK2017 octopus robot
Dependencies: 2017NHKpin_config mbed FEP ikarashiMDC PID jy901 omni HMC6352 omni_wheel
Fork of KANI2017v2 by
Diff: bot/sword_unit/sword_unit.cpp
- Revision:
- 23:37bb9afe9fdc
- Child:
- 25:d199d621ecca
diff -r 682cc376da6f -r 37bb9afe9fdc bot/sword_unit/sword_unit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bot/sword_unit/sword_unit.cpp Wed Sep 13 14:26:47 2017 +0900 @@ -0,0 +1,19 @@ +#include "sword_unit.h" + +Sword::Sword(DigitalOut* RS485Controller, Serial* RS485) : + swordMotor(RS485Controller, 1, 2, SM, RS485) +{ + swordMotor.braking = true; +} + +void Sword::move(float speed) +{ + //if(speed*right.getPosition() < 0) speed = 0; + //if(speed*right.getPosition() > 0) right.resetPosition(); + swordMotor.setSpeed(speed); +} + +void Sword::stop() +{ + swordMotor.setSpeed(0); +}