Control project for the Lift-arm. Works with ROS Melodic
Dependencies: mbed Servo ros_lib_melodic ULN2003_StepperDriver Async_4pin_Stepper
Diff: src/motor.h
- Revision:
- 5:71c2f193a7f9
- Parent:
- 4:9edb248c6431
--- a/src/motor.h Mon May 31 16:47:02 2021 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -#ifndef KARBOT_MOTOR_H -#define KARBOT_MOTOR_H - -/* Karbot motor class - * Written by Simon Krogedal - * 27/05/21 - * Team 9 4th Year project - * - * for NUCLEO-F401RE - * - */ - - #include "mbed.h" - - class motor { - - private: - PwmOut output; // PWM output pin - DigitalOut dir; // direction pin - - double T, dutCyc; // Period and duty cycle variables - bool driving; // flag on wheter the motor is driving or not - - public: - // constructor takes 2 pins and the period - motor(PinName pwm_pin, PinName dir_pin, double period); - - void drive(void); // drives at set direction and duty cycle - - void stop(void); // stops - - void setOut(double dc); // set the output, number between -1 and 1 - - double getPeriod(void); // returns period - - double getDuty(void); // returns dutycycle -}; - - - #endif \ No newline at end of file