尝试连接MPU6050到Beaglebone Black,在Beaglebone-IO下运行Debian,Node.js和Johnny-Five。
使用Johnny-Five初始化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请帮帮我!
发布于 2015-07-11 12:28:18
看起来Beaglebone-IO还没有更新对I2C的支持:https://github.com/julianduque/beaglebone-io/pull/16/files
https://stackoverflow.com/questions/31346274
复制相似问题