Breadboard for "Motor - Sparkfun TB6612FNG"

motor-TB6612FNG.png

Fritzing diagram: motor-TB6612FNG.fzz

 

Run this example from the command line with:

node eg/motor-TB6612FNG.js
var five = require("johnny-five");
var Tessel = require("tessel-io");
var board = new five.Board({
  io: new Tessel()
});

board.on("ready", function() {
  var spdt = new five.Switch("a0");
  var throttle = new five.Sensor("b0");

  // See the comments below for more information about
  // the pins shown in this pin array argument.
  var motor = new five.Motor([ "a5", "a4", "a3" ]);

  spdt.on("open", () => {
    motor.stop().forward(motor.speed());
  });

  spdt.on("close", () => {
    motor.stop().reverse(motor.speed());
  });

  throttle.on("change", () => {
    motor.speed(throttle.value >> 2);
  });
});

Additional Notes

Here's a breakdown of the pins used by these motor drivers, their corresponding Johnny-Five Motor class pin name, and capabilities:

Control Type/RoleJohnny-Five Motor Pin NameBreakout Printed Pin
PWMpwmPWMA or PWMB
Counter DirectioncdirAIN2 or BIN2
DirectiondirAIN1 or BIN1

 

Component Classes in this example:

Hi! The Johnny-Five community is building new projects every day. We made this newsletter to tell you about what's new, what's good, and what's next for Open Source robotics. Join us in exploring what we can make together.

Fork me on GitHub