rwaldron / johnny-five Goto Github PK
View Code? Open in Web Editor NEWJavaScript Robotics and IoT programming framework, developed at Bocoup.
Home Page: http://johnny-five.io
License: Other
JavaScript Robotics and IoT programming framework, developed at Bocoup.
Home Page: http://johnny-five.io
License: Other
[tag@chayot:~][01:24 PM]$ ls /dev/ | grep -iE 'usb' | grep tty
[tag@chayot:~][01:24 PM]$ ls /dev/ | grep -iE 'usb|acm' | grep tty
ttyACM0
[tag@chayot:~][01:24 PM]$
I guess this has to do with build-essentials?
Running on OSX 10.8 with the latest version of xcode installed.
Error: Could not load the bindings file. Tried:
-> /Users/HOMEDIR/Development/Arduino/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/build/Debug/serialport.node
-> /Users/HOMEDIR/Development/Arduino/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/build/Release/serialport.node
-> /Users/HOMEDIR/Development/Arduino/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/out/Debug/serialport.node
-> /Users/HOMEDIR/Development/Arduino/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/Debug/serialport.node
-> /Users/HOMEDIR/Development/Arduino/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/out/Release/serialport.node
-> /Users/HOMEDIR/Development/Arduino/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/Release/serialport.node
-> /Users/HOMEDIR/Development/Arduino/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/build/default/serialport.node
-> /Users/HOMEDIR/Development/Arduino/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/compiled/0.6/darwin/x64/serialport.node
at bindings (/Users/HOMEDIR/Development/Arduino/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/node_modules/bindings/bindings.js:82:13)
at Object.<anonymous> (/Users/HOMEDIR/Development/Arduino/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/serialport.js:7:43)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/Users/HOMEDIR/Development/Arduino/node_modules/johnny-five/node_modules/firmata/lib/firmata.js:9:18)
at Module._compile (module.js:441:26)
Hi everyone.
I tried to install johnny-five on my Windows system - anyone tried this??
Should we allow users to be able to specify a port in the board's constructor and skip the entire detection phase?
I'm nowhere near needing it yet, but my use case is that (very far) down the road I'd like to use multiple arduinos connected to a central controller for home automation purposes, so I could imagine that my code at that point would have multiple instances of Board with each bit of functionality requiring a specific arduino.
Calling a variable current
(as seen in lib/piezo.js
) might give people the wrong idea that they're controlling electrical current. Find/replace with something less ambiguous, maybe now
?
I see that ping requires a special build of Firmata. Are there more details on where to find the special build?
Do that.
No idea why, but it's broken.
You asked me to file a bug, so here I am.
First off, rad project. I'm hoping someone can steer me towards the light...
Attempting to run the demo code: (
var five = require("johnny-five"),
board = new five.Board();
board.on("ready", function() {
(new five.Led(13)).strobe();
});
Which fails with:
Connecting...�
Serial� Found possible serial port� ttyACM0
Board -> Serialport� connected�
Board <- Serialport ready�
Repl� Successfully Connected�
firmata > �Board� Closing connection to board, serialport
/home/usernamehere/projects/johnny-five/node_modules/firmata/lib/firmata.js:13341: Uncaught TypeError: Cannot set property 'mode' of undefined
ArchLinux
NPM version 1.1.46
Node version v.0.8.5
Arduino Uno via USB
thanks in advance...
First of all, not only is this a fantastic library but setup was < 30 seconds. Serious props.
This is a minor issue and I'm just getting started with this library, but for some reason I'm noticing that I only receive the message "Closing connection to board, serialport" every other time I fire up the server and then shut it down. When I don't receive the connection closing message, the next time I start the server I don't get the "firmata >" message that precedes the functionality on the board kicking off, and the servos/leds don't work as expected (at all).
Should I be receiving the connection closing message every time I kill the server, and if so, is there a step I'm missing? Thanks!
Moving motors with an H-bridge is very popular, especially with simpler/cheaper kits. It is the main solution when a servo or a stepper won't do.
I have the popular SN754410 on my rig but all H-bridges work the same. For one motor, you'll have a dual H-bridge that has a clockwise, counter clockwise and optional brake signal. A quad just lets you control 2 motors.
I'm planning on copying the style of motor.js. How does that sound?
I'm not 100% sure if this is a bug with the docs or not, but, I've got an Arduino uno board, using the Arduino 1.0.1 IDE and I can't get johnny-five to run (because I can't get version 2.2 of StandardFirmata loaded).
I've tried also using IDE 1.0 and pushing in Firmata 2.2 as per documentation, but I just get lots of compile errors (on verify - mostly to do with WProgram.h now being Arduino.h).
I tried a hacky find and replace:
#if defined(ARDUINO) && ARDUINO >= 100
#include <Arduino.h> // for digitalRead, digitalWrite, etc
#else
#include <WProgram.h> // for digitalRead, digitalWrite, etc
#endif
But that then fails even more, probably because the rest of Firmata is expecting WProgram.
I appreciate this isn't a bug in this project, but the steps to get started is where I was falling down!
I did manage to get a version of Firmata running, but I get this error from Johnny-five:
» node strobe.js
1347838694900 Board Connecting...
1347838694910 Serial Found possible serial port cu.usbmodemfd121
1347838694911 Board undefined is not a function
events.js:68
throw new Error("Uncaught, unspecified 'error' event.");
^
Error: Uncaught, unspecified 'error' event.
at Board.EventEmitter.emit (events.js:68:15)
at Board.<anonymous> (/Users/remy/node_modules/johnny-five/lib/board.js:246:12)
at Board.Serial.detect (/Users/remy/node_modules/johnny-five/lib/board.js:134:16)
at ChildProcess.exithandler (child_process.js:538:7)
at ChildProcess.EventEmitter.emit (events.js:91:17)
at maybeClose (child_process.js:638:16)
at Process._handle.onexit (child_process.js:680:5)
Any ideas?
/media/Archivos/Arduino Labs/Examples/WebLed/node_modules/johnny-five/lib/ping.js:54
this.firmata.pulseIn( settings, function( duration ) {
^
TypeError: Object [object Object] has no method 'pulseIn'
at Ping. (/media/Archivos/Arduino Labs/Examples/WebLed/node_modules/johnny-five/lib/ping.js:54:18)
at Timer. (native)
when i am using ping i get this error! , using the docs example!
The sixth byte returned from the nunchuk is not currently being decoded and used for button events. in order to properly claim nunchuk support these events need to be captured and bubble up.
Allow a specified range
to determine when a "range", "entry" or "detect" event is fired.
Examples:
var sonar = new five.Sonar("A2");
sonar.range( 6, 20 ).on("range", function() {
// object detected within a 6-20 inch range
});
var sonar = new five.Sonar("A2");
sonar.range([ 6, 20 ]).on("range", function() {
// object detected within a 6-20 inch range
});
var sonar = new five.Sonar({
pin: "A2",
range: [ 6, 20 ]
});
sonar.on("range", function() {
// object detected within a 6-20 inch range
});
I've been looking at http://www.arduino.cc/playground/Main/LedControl, which is a library for using a MAX7219 chip to control an LED matrix or a set of seven-segment displays. It uses the shiftOut
functionality that I originally saw in shift register examples. Presently, johnny five implements the shiftOut
functionality in the ShiftRegister API, but it doesn't provide it as a separate method. I think that this should actually be a method on board instances, rather than falling under the ShiftRegister API, because I'm understanding now that it has broader utility.
Pull request coming shortly, but more for discussion than necessarily to be landed.
I think it would be cool to control robots with a gamepad
There are many ways to do so:
But what about node-serialport?
We could cut all those dependencies with a gamepad api for serialport.
That would be nice in case of johnny-five running on an ARM board like Raspberry PI, Beagle,...
without any framework or browser installed.
Would it make sense to port a lib like pygame-joystick?
http://www.pygame.org/docs/ref/joystick.html
Or implementing the structure of the w3c standard?
http://www.w3.org/TR/gamepad/
The yellow-cable is supposed to go to digital 7 and not Analog 2.
This might confuse people :)
https://github.com/rwldrn/johnny-five/blob/master/docs/ping.md#breadboard
I am planning to use these library for my home authomatization and i gonna be using relays, are you planning to implement some type of object for manipulating relays. (btw: Sorry for my bad english)
I feel it would be useful to have the servo configuration/helpers from the Navigator example ( https://github.com/rwldrn/johnny-five/blob/master/eg/navigator.js ) promoted into a constructor in /lib. Not sure if rover is the best name but it's the best I've got so far.
The goal would be to provide a device independent API for controlling the movement of wheeled/tracked robots. Making sure it's simple to go forward, reverse, turn and pivot.
I can start the work, but I want to make sure it's a good idea :)
@haugstrup has a proof of concept here -- wanted to see if we can move the discussion to here!
Need to transition to using private WeakMap
I'm using an Arduino Ethernet and when trying to start
node eg/repl.js
I get
~/dev/tests/johnny-five > node eg/repl.js
1342540562581 Board Connecting...
1342540562589 Serial Found possible serial port cu.usbmodemfa141
1342540562590 Board -> Serialport connected cu.usbmodemfa141
But I'm never reaching the console.log
statement.
Same problem with something simple like leb-strobe.js
.
Arduino IDE version : 1.0.1
Node version : Tried with 0.6.18 and 0.8.2
Arduino : Arduino Ethernet
right now the accelerometer for the nunchuk is returning raw data but not emiting directional events. ideally we need events for when the nunchuk moves forward, right, left, back and if possible diagonal directions.
The basic example needs a tiny modification to make it work when building from source:
var five = require("./lib/johnny-five")
Might be worth mentioning in the readme.
Other then that getting started is really easy. I hope that Firmata hanging issue gets resolved eventually, I stumbled on that on the first try. Looks like it ends up hanging on every other attempt.
It doesn't look like Windows supports these signals and results in an error being thrown:
http://stackoverflow.com/questions/10021373/what-is-the-windows-equivalent-of-process-onsigint-in-node-js
nodejs/node-v0.x-archive#1553
Not sure what an equivalent event might be. Still looking into it.
When I start the simple example from the README the callback on ready
is never called. It seems to connect to the board as it prints:
1337288872941 Board Connecting...
1337288872963 Board -> Serialport connected
I'm adding a simple console.log()
into the callback but it was nerver printed.
I'm using an Arduino Duemilanove
I'm trying to get Johnny Five running on Raspbian. NPM was having issues (and the native extensions wouldn't compile) but the bindings are erroring out. Is that on the Firmata side of things?
/home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/node_modules/bindings/bindings.js:85
throw err
^
Error: Could not load the bindings file. Tried:
-> /home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/build/Debug/serialport.node
-> /home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/build/Release/serialport.node
-> /home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/out/Debug/serialport.node
-> /home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/Debug/serialport.node
-> /home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/out/Release/serialport.node
-> /home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/Release/serialport.node
-> /home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/build/default/serialport.node
-> /home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/compiled/0.6/linux/arm/serialport.node
at bindings (/home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/node_modules/bindings/bindings.js:82:13)
at Object. (/home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/node_modules/serialport/serialport.js:7:44)
at Module._compile (module.js:446:26)
at Object..js (module.js:464:10)
at Module.load (module.js:353:32)
at Function._load (module.js:311:12)
at Module.require (module.js:359:17)
at require (module.js:375:17)
at Object. (/home/pi/www/j5/node_modules/johnny-five/node_modules/firmata/lib/firmata.js:9:18)
at Module._compile (module.js:446:26)
Enhancement.
Define an rgb led as a single led e.g.:
new led = rgbLed(12,13,14); Pins for (r,g,b)
led.set(valr,valg,valb);
or
led.color(val) where val is a hex code or other colour definition
Hi Rick, i just wanna know if i can make you some questions for a magazine that in my classroom we are making for a Robotics Event in our university here on Panama, I will be glad if you can give me your email so i can send you some questions for an article of Johnny Five and Javascript Robotics, Thanks!
Copied from 0d48903#commitcomment-1608254
Just wanted to let you know that this caused an issue for me - getting the message "1342771316516 Board No USB devices detected".
When I change the line back to if ( !(/tty/i).test(val) ) it works fine.My Arduino is on /dev/ttyACM0 (Ubuntu 12.04, 64bit).
Best regards,
Roland
When I try to install the package I got the following errors:
spawn python [ '/Users/andreaskoberle/.node-gyp/0.6.18/tools/gyp_addon',
'binding.gyp',
'-I/Users/andreaskoberle/Documents/johnny five/johnny-five/node_modules/microtime/build/config.gypi',
'-f',
'make' ]
ERR! Error: not found: make
at F (/usr/local/lib/node_modules/npm/node_modules/which/which.js:43:28)
at E (/usr/local/lib/node_modules/npm/node_modules/which/which.js:46:29)
at Object.oncomplete (/usr/local/lib/node_modules/npm/node_modules/which/which.js:57:16)
ERR! not ok
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the microtime 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 microtime
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Darwin 11.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/andreaskoberle/Documents/johnny five/johnny-five
npm ERR! node -v v0.6.18
npm ERR! npm -v 1.1.21
npm ERR! code ELIFECYCLE
npm ERR! message [email protected] install: `node-gyp rebuild`
npm ERR! message `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! errno {}
npm http 304 https://registry.npmjs.org/semver
npm http 304 https://registry.npmjs.org/prompt
npm http 304 https://registry.npmjs.org/nopt
npm http 304 https://registry.npmjs.org/hooker
Checking for program g++ or c++ : not found
/Users/andreaskoberle/Documents/johnny five/johnny-five/node_modules/firmata/node_modules/serialport/serialport_native/wscript:9: error: could not configure a cxx compiler!
cp: build/Release/serialport_native.node: No such file or directory
npm http 200 https://registry.npmjs.org/tap
npm http GET https://registry.npmjs.org/tap/-/tap-0.2.5.tgz
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/andreaskoberle/Documents/johnny five/johnny-five/npm-debug.log
npm not ok
Is it possible to have multiple five.Leds to control multiple groups of Leds separately.
Also is it possible to control a single LED within the five.Leds?
Should we allow users to be able to specify a port in the board's constructor and skip the entire detection phase?
I'm nowhere near needing it yet, but my use case is that (very far) down the road I'd like to use multiple arduinos connected to a central controller for home automation purposes, so I could imagine that my code at that point would have multiple instances of Board with each bit of functionality requiring a specific arduino.
Update the npm module to the github version.
Instead of sending new Date(), create a generic Board.Event.
Detection:
In recent versions of SerialPort, there's support for listing available Serial Ports via SerialPort.list(function( err, results ) {})
I don't have access to a native linux / unix box to test support on there right now ( having problems with my VM ), but as for port detection, this works perfectly on Windows.
Connection:
Attempting to connect to a valid but non-arduino Serial Port results in app looking like it's hanging. Still looking at this to get more details on what's going on - if you connect explicitly to a valid arduino port, things seem to work fine ( the basic blink app works! )
when i try to run example led-fade i get this error in console
node --version v0.5.11-pre
Firmata-2.2
xxxx@ubuntu:~/johnny-five$ sudo node eg/led-fade.js
1349810860275 Board Connecting...
1349810860283 Serial Found possible serial port ttyUSB0
1349810860284 Board -> Serialport connected ttyUSB0
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: Object #<Object> has no method 'open'
at Array.1 (/home/yoshco/johnny-five/node_modules/firmata/node_modules/serialport/serialport.js:106:23)
at EventEmitter._tickCallback (node.js:192:40)
(...mostly documentation related... sorry it's a bit of a ramble)
Trying to get the LED working with the hacktronics tutorial for the 4x4 Blue, the pins in the docs do not match what the tutorial is set to. It would be nice if they did.
I tried to get the board working with pins: [ 12, 10, 5, 4, 3, 2]
, but had no joy :( I'll keep playing till I get it going and post here once it's working. I confirmed the board was working correctly by running the sample code in the hacktronics tutorial. I also tested that the firmata was ok by turning on an LED when the LCD fires its on event.
An enhancement (in the docs) might be to allow the LCD pins to be set explicitly. I can see from debugging that there is a an object representing the pins: { rs: 12, en: 11, data: [ 3, 4, 5, 10 ] }
.
Also, note that in the table of the hacktronics website (and on the board itself) there is no pin labelled "EN" (I assume that this is "E"?).
Also, it's not clear to me which pin controls the backlight? On my Arduino (and in the tutorial), that's set to pin 13. I can turn that on as an LED, but that seems like a bit of a hack.
Johnny-Five in a chrome extension? Madness!
eg. calling led.pulse() or fade() while using a non-PWM pin should log an error indicating that a PWM pin should be used.
I'm trying to create a simple button that will log to the console for up / down button presses.
I've tested wiring up a button using the example in the docs (https://github.com/rwldrn/johnny-five/blob/master/docs/button.md) and also run the eg/button.js
version (https://github.com/rwldrn/johnny-five/blob/master/eg/button.js). Unfortunately, I'm having no luck whatsoever, but there's every chance I'm making some obvious mistake :)
One reason I thought I'd post here as an issue to sanity check, is that I am able to get a very similar demo working correctly using the Arduino IDE directly. For example, this sample code works fine when uploaded to the board: http://arduino.cc/it/Tutorial/Button
However, when trying to run a similar version via Johnny-five and standard firmata (and after adjusting the pins / wiring to be correct), I'm unable to get console output for the button events. If I manually emit the events using button.emit('down')
etc, the event handlers fire correctly, so it feels like it's a case of not registering a digitalRead via the board input.
I also noticed earlier troubleshooting for button events that you had done so wondered if it was related? firmata/firmata.js#5
Are buttons working fine for others? When wired up and run against examples like eg/button.js
. Is there some preliminary configuration I've overlooked such as manually setting pinMode states?
On a side note, please let me know if there is an IRC channel or better place to troubleshoot than raising github issues :)
And thanks Rick and the all contributors for providing the framework.
Cheers,
Ian
It would be nice to see an (small and simple) example to push my measured data into an sql-based database :)
My node.js knowledge is not so advanced yet, so if you have any hints i will program it and push it to github.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.