Johnny-Five apps always fail with RangeError after less than 1 second

240 Views Asked by At

My Johnny-Five apps are all failing after less than 1 second. I've tried with 0.7.9 and 0.7.8. This is the error I'm seeing:

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

With 0.7.2 it does not give me this error, however I am unable to move my servos. I'm seeing this issue happen with all of the Servo examples from the Johnny-Five readme as well. I'm also ruling out a hardware issue because it has given me the same problem on 3 different servos. Also, I only see the issue when the servo is plugged in to the 5V and not the 3.3V, which is very odd. Node.js is also the latest (0.10.22).

I've tried 2 different Arduino Uno boards and 2 different laptops (both running OSX 10.9) as well, and I see the exact same issue on everything.

1

There are 1 best solutions below

0
On

Sorry that no one has answered this, I didn't even know these questions existed :(

The simple answer is that you can't attach Servos directly to the board without an external power source. What you're seeing is the USB port itself crashing because the current draw maxed out and asked for more.

As far as I can tell, there is no elegant way to handle these failures—the USB port simply stops responding.