ai_car1

Dependencies:   mbed ai_car ros_lib_melodic

Committer:
wngudwls000
Date:
Mon May 03 07:22:52 2021 +0000
Revision:
0:a35213e1e14e
45

Who changed what in which revision?

UserRevisionLine numberNew contents of line
wngudwls000 0:a35213e1e14e 1 #ifndef MBED_SERVO_H
wngudwls000 0:a35213e1e14e 2 #define MBED_SERVO_H
wngudwls000 0:a35213e1e14e 3
wngudwls000 0:a35213e1e14e 4 #include "mbed.h"
wngudwls000 0:a35213e1e14e 5
wngudwls000 0:a35213e1e14e 6 #define MAX 75
wngudwls000 0:a35213e1e14e 7 #define MID 0.00165
wngudwls000 0:a35213e1e14e 8
wngudwls000 0:a35213e1e14e 9 class Servo
wngudwls000 0:a35213e1e14e 10 {
wngudwls000 0:a35213e1e14e 11 private:
wngudwls000 0:a35213e1e14e 12 DigitalOut m_PWM;
wngudwls000 0:a35213e1e14e 13 Ticker m_period_ticker;
wngudwls000 0:a35213e1e14e 14 Timeout m_width_timeout;
wngudwls000 0:a35213e1e14e 15 float m_degree;
wngudwls000 0:a35213e1e14e 16 float m_width;
wngudwls000 0:a35213e1e14e 17
wngudwls000 0:a35213e1e14e 18 void setPeriod();
wngudwls000 0:a35213e1e14e 19 void setWidth();
wngudwls000 0:a35213e1e14e 20 public:
wngudwls000 0:a35213e1e14e 21 Servo(PinName IN);
wngudwls000 0:a35213e1e14e 22 void update(float degree);
wngudwls000 0:a35213e1e14e 23 float getDegree();
wngudwls000 0:a35213e1e14e 24 };
wngudwls000 0:a35213e1e14e 25
wngudwls000 0:a35213e1e14e 26 #endif