尝试将 MPU6050 连接到在 Beaglebone-IO 下运行 Debian、Node.js 和 Johnny-5 的 Beaglebone Black。
使用 Johnny-5 示例初始化 MPU6050:
var imu = new five.IMU({
controller: "MPU6050"
});
每次发生错误时:
TypeError: Object #<BeagleBone> has no method 'i2cConfig'
at EventEmitter.Drivers.MPU6050.initialize.value (/root/node_modules/johnny-five/lib/imu.js:42:12)
at Object.Drivers.get (/root/node_modules/johnny-five/lib/imu.js:345:12)
at Accelerometer.Controllers.MPU6050.initialize.value (/root/node_modules/johnny-five/lib/accelerometer.js:65:34)
at new Accelerometer (/root/node_modules/johnny-five/lib/accelerometer.js:319:10)
at IMU.Controllers.MPU6050.initialize.value (/root/node_modules/johnny-five/lib/imu.js:368:31)
at new IMU (/root/node_modules/johnny-five/lib/imu.js:506:10)
at Board.io.on.socket.on.newspeed (/root/rov/server/server.js:56:13)
at Board.emit (events.js:92:17)
at process._tickCallback (node.js:419:13)
我想这与 i2c 配置有关,因为我无法使用 npm install i2c 安装 i2c,它总是输出:
make: *** [Release/obj.target/i2c/src/i2c.o] Error 1
make: Leaving directory `/root/node_modules/i2c/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/share/node- gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:809:12)
gyp ERR! System Linux 3.8.13-bone70
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /root/node_modules/i2c
gyp ERR! node -v v0.10.29
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! i2c@0.2.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the i2c@0.2.1 install script.
npm ERR! This is most likely a problem with the i2c package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls i2c
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.8.13-bone70
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "i2c"
npm ERR! cwd /root/rov/server
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/rov/server/npm-debug.log
npm ERR! not ok code 0
请帮忙!