MotorHat/Servo

(require("MotorHat/Servo"))(opts) → {module:MotorHat/Servo~servo}

Creates a servo motor controller.
Pass in an options object to generate an uninitialized ServoLib object.

Parameters:
Name Type Description
opts Object

Servo controller initialization options.

Properties
Name Type Description
pwm Object

PWM Interface Object

pin Number

Servo controller pin. Which pin (0 to 15) is the servo connected to?

min Number

Duration in ms of pulse at position 0.

max Number

Duration in ms of pulse at position 100.

freq Number

PWM Controller frequency for the servo.

Source:
Basic Usage:
const opts = {
pwm: pwm,
pin: 1,
min: 0.7,
max: 3.2,
freq: 1600
};
const servo = require('./servo.js')(opts);
Returns:
Type
module:MotorHat/Servo~servo

Namespaces

servo