firmata.js icon indicating copy to clipboard operation
firmata.js copied to clipboard

Controlling Tinkerkit's Braccio with firmata.js

Open cnizo opened this issue 6 years ago • 2 comments

Hello! I am sorry if this is an obvious question, but I have been trying to control Braccio from Tinkerkit with firmata.js, but the servoWrite function has no effect on it. I have uploaded StandardFirmata on Arduino UNO. From the Braccio library for Arduino I saw that the servos are attached to pins 11, 10, 9, 6, 5 and 3, so can't I just use servoWrite with this pins and the desired angles?

Thanks!

cnizo avatar Apr 06 '18 14:04 cnizo

It certainly looks like it should work. Could you share your code? It might make it easier to diagnose.

dtex avatar Apr 08 '18 23:04 dtex

This is what I tried to do. I dig a little and when I run the code the function "Board.prototype.pwmWrite" on firmata.js is called.

`var Board = require('firmata');

Board.requestPort(function (error, port) {
  if (error) {
    console.log(error);
    return;
  }

  board = new Board(port.comName, { samplingInterval: 1000 });

  board.on('open', function () {
    console.log('  board opened');
    alert('board opened')
  });

  board.on('ready', function () {
    console.log('  board ready');
    board.pinMode(11,board.MODES.SERVO);
    board.pinMode(10,board.MODES.SERVO);
    board.pinMode(9, board.MODES.SERVO);
    board.pinMode(6, board.MODES.SERVO);
    board.pinMode(5, board.MODES.SERVO);
    board.pinMode(3, board.MODES.SERVO);

    board.servoWrite(11,85);
    board.servoWrite(10,85);
    board.servoWrite(9,85);
    board.servoWrite(6,85);
    board.servoWrite(5,85);
    board.servoWrite(3,60);
  });
});`

cnizo avatar Apr 09 '18 07:04 cnizo