motor i senzor
Dependencies: TextLCD mbed PinDetect
Diff: MotorDrivers/Motor.h
- Revision:
- 3:bebfc64cefe4
- Parent:
- 1:3500bf8487d0
- Child:
- 4:03b68322905f
diff -r 0bf41ad96558 -r bebfc64cefe4 MotorDrivers/Motor.h --- a/MotorDrivers/Motor.h Sat Nov 09 07:04:13 2013 +0000 +++ b/MotorDrivers/Motor.h Sat Nov 09 13:44:18 2013 +0000 @@ -3,23 +3,27 @@ #include "mbed.h" -#define motorDriveTime 1000 // vrijeme koje se motor kreće, u milisekundama. +#define motorDriveTime 100 // vrijeme koje se motor kreće, u milisekundama. +#define motorPwmPeriod 0.010 // PWM period to 10 ms +#define motorPwmInitDutyCycle 0.5 // PWM initial duty cycle, 50% +#define motorPwmWaitTime 0.02 // PWM wait time in sec. +#define motorPwmChangeSpeed 0.2 // PWM value change class Motor { private: DigitalOut positiveOut, negativeOut; - -protected: + PwmOut pwmOut; short direction; - Motor(); void move(); + bool _isMoving; public: - Motor(PinName, PinName); + Motor(PinName, PinName, PinName); void movePositive(); void moveNegative(); - void stop(); + void stop(); + bool isMoving(); };