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: QEI Motordriver ros_lib_melodic
motor/Motor.cpp
- Committer:
- florine_van
- Date:
- 2019-10-22
- Revision:
- 5:8ef79eebbc97
- Parent:
- 0:57855aafa907
- Child:
- 6:858a5116688e
File content as of revision 5:8ef79eebbc97:
#include "Motor.h"
///////////////////////////////////////////////////////////////////
// Constructor
///////////////////////////////////////////////////////////////////
Motor::Motor(PinName in1, PinName in2, PinName pwm)
: in1(in1), in2(in2), pwm(pwm) {}
///////////////////////////////////////////////////////////////////
// Public methods
///////////////////////////////////////////////////////////////////
//TODO
void Motor::moveForward()
{
in1 = 1;
in2 = 0;
pwm.period_ms(10);
pwm.write(0.5f);
}
//TODO
void Motor::moveBack()
{
pwm.period_ms(10);
pwm.write(0.5f);
}
//TODO
void Motor::turnLeft()
{
in1 = 0;
in2 = 1;
pwm.period_ms(10);
pwm.write(0.5f);
}
//TODO
void Motor::turnRight()
{
pwm.period_ms(10);
pwm.write(0.5f);
}