ng ho lung / Mbed OS XP70HV

Servo.cpp

Committer:
leonNg
Date:
2020-06-23
Revision:
0:e35f0aee6a1f

File content as of revision 0:e35f0aee6a1f:

#include "mbed.h"
#include "Servo.h"

Servo::Servo(PinName pin, double period, double pulseWidth)
{
  servo = new PwmOut(pin);
  this->period = period;
  this->pulseWidth = pulseWidth;
  init();
}

void Servo::servoMove(double width)
{
  servo->pulsewidth(width);
}

void Servo::init()
{
  servo->period(period);
}