ai_car1
Dependencies: mbed ai_car ros_lib_melodic
Diff: Actuator/Servo.h
- Revision:
- 0:a35213e1e14e
diff -r 000000000000 -r a35213e1e14e Actuator/Servo.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Actuator/Servo.h Mon May 03 07:22:52 2021 +0000 @@ -0,0 +1,26 @@ +#ifndef MBED_SERVO_H +#define MBED_SERVO_H + +#include "mbed.h" + +#define MAX 75 +#define MID 0.00165 + +class Servo +{ +private: + DigitalOut m_PWM; + Ticker m_period_ticker; + Timeout m_width_timeout; + float m_degree; + float m_width; + + void setPeriod(); + void setWidth(); +public: + Servo(PinName IN); + void update(float degree); + float getDegree(); +}; + +#endif \ No newline at end of file