Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: 2017NHKpin_config FEP HMC6352 PID QEI R1307 ikarashiMDC omni_wheel
Fork of KANIv3 by
bot/tentacle_unit/tentacle_unit.cpp
- Committer:
- number_key
- Date:
- 2017-11-23
- Revision:
- 52:320f910ca6ca
- Parent:
- 49:69a7235d837a
File content as of revision 52:320f910ca6ca:
#include "tentacle_unit.h"
Tentacle::Tentacle(DigitalOut* RS485Controller, Serial* RS485) :
tentacleMotor({
{RS485Controller, 1, 3, SM, RS485},
{RS485Controller, 1, 1, SM, RS485},
}),
right(PWM3, PWM6),left(PWM8,PWM10),
debugSerial(USBTX, USBRX, 115200)
{
tentacleMotor[0].braking = true;
tentacleMotor[1].braking = true;
}
void Tentacle::rightMove(float speed)
{
/*if(speed*right.getPosition() < 0) speed = 0;
if(speed*right.getPosition() > 0) right.resetPosition();*/
tentacleMotor[0].setSpeed(speed);
}
void Tentacle::leftMove(float speed)
{
/*if(speed*left.getPosition() < 0) speed = 0;
if(speed*left.getPosition() > 0) left.resetPosition();*/
tentacleMotor[1].setSpeed(speed);
}
void Tentacle::stop()
{
tentacleMotor[0].setSpeed(0);
tentacleMotor[1].setSpeed(0);
}
void Tentacle::debugPrint()
{
debugSerial.printf("right:%d left:%d\r\n",right.getPosition(),left.getPosition());
}
