我的 Johnny-Five 应用程序在不到 1 秒后都失败了。我试过 0.7.9 和 0.7.8。这是我看到的错误:
ytham:[master]~/js/deltarobot$ node .
1386668719984 Board Connecting...
1386668719986 Board -> Serialport connected /dev/cu.usbmodem1421
1386668723299 Board <- Serialport connected /dev/cu.usbmodem1421
1386668723299 Repl Initialized
>> 1386668723348 Board
string_decoder.js:109
charStr += buffer.toString(this.encoding, 0, end);
^
RangeError: toString() radix argument must be between 2 and 36
at Number.toString (native)
at StringDecoder.write (string_decoder.js:109:21)
at ReadStream.onData (readline.js:839:39)
at ReadStream.EventEmitter.emit (events.js:95:17)
at Board.<anonymous> (/Users/ytham/js/deltarobot/node_modules/johnny-five/lib/board.js:305:27)
at Board.<anonymous> (/Users/ytham/js/deltarobot/node_modules/johnny-five/lib/board.js:124:18)
at SerialPort.<anonymous> (/Users/ytham/js/deltarobot/node_modules/johnny-five/node_modules/firmata/lib/firmata.js:402:13)
at SerialPort.EventEmitter.emit (events.js:95:17)
at afterRead (/Users/ytham/js/deltarobot/node_modules/johnny-five/node_modules/serialport/serialport.js:303:18)
at /Users/ytham/js/deltarobot/node_modules/johnny-five/node_modules/serialport/serialport.js:342:9
使用 0.7.2 它不会给我这个错误,但是我无法移动我的伺服器。我看到 Johnny-5 自述文件中的所有 Servo 示例都出现了这个问题。我也排除了硬件问题,因为它在 3 个不同的伺服系统上给了我同样的问题。此外,我只在伺服器插入 5V 而不是 3.3V 时看到问题,这很奇怪。Node.js 也是最新的(0.10.22)。
我也尝试了 2 种不同的 Arduino Uno 板和 2 种不同的笔记本电脑(均运行 OSX 10.9),并且我在所有东西上都看到了完全相同的问题。