MotorHat/DC

(require("MotorHat/DC"))(opts) → {module:MotorHat/DC~dc}

Creates a new DC motor controller

Pass in an options object to generate an uninitialized DCLib object.

Parameters:
Name Type Description
opts Object
Properties
Name Type Description
pwm Object

PWM Interface Object

pins Object

Pin definition for the motor.

Properties
Name Type Description
PWM Number

Pin number of the PWM output for the DC motor.

IN1 Number

Pin number of the first coil output for the DC motor.

IN2 Number

Pin number of the second coil output for the DC motor.

Source:
Basic Usage:
const opts = {
pwm: pwm,
pins: {
PWM: 8,
IN1: 10,
IN2: 9,
},
speed: 50,
freq: 1600,
};
const dc = require('./dc.js')(opts).init();
Returns:
Type
module:MotorHat/DC~dc

Namespaces

dc