MotorHat

(require("MotorHat"))(optsopt) → {module:MotorHat~motorhat}

Creates a new MotorHat controller.

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

Parameters:
Name Type Attributes Description
opts Object <optional>
Properties
Name Type Attributes Description
adress Integer <optional>

i2c address of the PWM chip on the MotorHat.

  • 0x6F for knockoff HATs.

  • 0x60 for official AdaFruit HATs??

busnum Integer <optional>

i2c driver devfile number. Varies by RaspBerry version.
Should be automatically detected.

steppers Array <optional>

Definition of the stepper motors connected to the HAT.
At most 2 steppers, each motor is represented by either an object of the form
{W1: winding, W2: winding}. Each winding should be one of following: 'M1', 'M2', 'M3',
'M4' depending on the port the stepper is connected to. Correct example: {W1: 'M3', W2: 'M1'}

dcs Array.<String> <optional>

Definition of the DC motors connected to the HAT.
At most 4 DCs, each should be one of following: 'M1', 'M2', 'M3', 'M4' depending on
port the motor is connected to.

servos Array.<Integer> <optional>

Definition of the servos connected to the HAT.
List of the channels that have servos connected to them. 0 to 15.

Source:
Basic Usage:
const motorHat = require('motor-hat')({addr: 0x6F}).init();
Returns:
Type
module:MotorHat~motorhat

Namespaces

motorhat