Closed ugate closed 8 years ago
Platform specific bus
property support needs to be handled by the IO Plugin—all Johnny-Five does is forward the options passed to the component class constructor, through to the the i2cConfig(...)
call.
What version of Node.js is on the Chip?
nvm, I see that this project points to the nodesource install instructions—very smart.
I just found this: https://github.com/xtacocorex/CHIP_IO/issues/11
@ugate This should allow you to specify the bus as shown in the following:
var a = new five.Servo({
bus: 1,
address: 0x40,
controller: "PCA9685",
pin: 0,
});
@rwaldron Thanks for the update! I noticed the same thing on #9. What threw me off is the docs that state that Board.i2cConfig([milliseconds])
takes an optional millisecond parameter rather than an object of options. Should the docs be updated to reflect an options object instead?
@ugate it would be awesome if you could submit a pull request to the Johnny Five docs your Board.i2cConfig([milliseconds])
observation.
I tested a PCA9685 with chip-io (master branch) and noticed that nothing was happening using the johnny-five example. It looks like errors are just consumed in i2c.js so there's no way of knowing unless debugging (headless chip, used
node --inspect
flag with devtools from remote PC). Maybe a better approach when encountering errors would be to emit anerror
event instead of throwing or ignoring? I noticed thatchip-io.js
uses a hard-coded 1 for the bus value in/dev/i2c-1
here and here, but als /dev
only showsi2c-0
andi2c-2
(Linux 4.4.11-ntc).@rwaldron I'm trying to understand what the proper way to pass in the bus identifier when using the johnny-five API/
Board.i2c
functions for boards that support more than one I2C bus?