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.
Fork of Motor by
motor.cpp
- Committer:
- number_key
- Date:
- 2016-09-05
- Revision:
- 0:ebfdfce2d069
- Child:
- 1:0efe3050d83e
File content as of revision 0:ebfdfce2d069:
#include "motor.h"
#include "mbed.h"
Motor::Motor(PinName pin1, PinName pin2, PinName pin3) : _pin1(pin1), _pin2(pin2), _pin3(pin3)
{
_pin1 = 0;
_pin2 = 0;
_pin3 = 0;
}
void Motor::motor(float n)
{
if(n > 0) {
_pin1=0;
_pin2=1;
_pin3=n;
} else if(n < 0) {
_pin1=1;
_pin2=0;
_pin3=-n;
} else {
_pin1=0;
_pin2=0;
_pin3=1;
}
}
