Alex Pirciu
/
BFMC
a
Diff: include/Drivers/servo.hpp
- Revision:
- 1:ceee5a608e7c
diff -r c3e774091195 -r ceee5a608e7c include/Drivers/servo.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/Drivers/servo.hpp Thu Mar 28 07:44:42 2019 +0000 @@ -0,0 +1,44 @@ +/** + ****************************************************************************** + * @file SERVO.hpp + * @author RBRO/PJ-IU + * @version V1.0.0 + * @date day-month-2017 + * @brief This file contains the class declaration for the steering SERVO + * functionality. + ****************************************************************************** + */ + +/* Include guard */ +#ifndef SERVO_HPP +#define SERVO_HPP + +#include <mbed.h> + + +namespace drivers{ + /** + * @brief It is used for implementing SERVO functionality. + * + */ + class SERVO + { + public: + /* Constructor */ + SERVO(PinName _pwm); + /* Destructor */ + ~SERVO(); + /* Set angle */ + void SetAngle(float angle); //-25 to 25 degr + private: + /* convert angle to duty cycle */ + float conversion(float angle); //angle to duty cycle + /* PWM value */ + PwmOut pwm; + /* Current angle */ + float current_angle; + }; +}; // namespace drivers + + +#endif