M-M-M/software/lib/MMM/Motor.h
dviid 4a2f82f907 Updates: Motion + Motor
Integration with unsyncable branch
2013-01-28 11:58:58 +01:00

62 lines
1.3 KiB
C++
Executable File

/*
Motor.h - Motor library
Copyright (c) 2012 Copenhagen Institute of Interaction Design.
All right reserved.
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser Public License for more details.
You should have received a copy of the GNU Lesser Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ author: dviid
+ contact: dviid@labs.ciid.dk
*/
enum MOTOR{
MOTORA = 0,
MOTORB = 1
};
enum DIRECTION {
FORWARD,
BACKWARD
};
class MMotor {
public:
MMotor(MOTOR m);
void init();
void torque(int value);
int torque();
void direction(DIRECTION d);
DIRECTION direction();
void stop();
void start();
void restart();
protected:
MOTOR _m;
DIRECTION _d;
int _t; // torque
};
extern MMotor MotorA;
extern MMotor MotorB;