Refactoring Ironcup 2020
Dependencies: mbed mbed-rtos MotionSensor EthernetInterface
Diff: Motor/Motor.hpp
- Revision:
- 0:8f5db5085df7
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Motor/Motor.hpp Mon Sep 21 21:42:07 2020 +0000 @@ -0,0 +1,32 @@ +#ifndef MOTOR_HEADER +#define MOTOR_HEADER + +#include "mbed.h" +#include "CarPWM.h" + +class Motor{ + + protected: + Ticker interruption; + bool alternate_motor; + float velocity; + float jog_duty_cycle; + float jog_period; + PwmOut motor; + + public: + + void startJogging(float jog_dc, float jog_p); + void stopJogging(void); + void brakeMotor(float brake_intensity, float brake_wait); + void reverseMotor(int speed); + void setVelocity(int new_velocity); + float getVelocity(); + void setSmoothVelocity(int new_velocity); + Motor(PinName motor_pin); + + private: + void motorJogging(void); + +}; +#endif \ No newline at end of file