Code Monkey home page Code Monkey logo

johnny-five's Introduction

Johnny-Five

The JavaScript Robotics Programming Framework

Artwork by Mike Sgier

Build, Lint, Test and Measure Coverage Appveyor Build Status Coverage Status Install Size Gitter

Johnny-Five is an Open Source, Firmata Protocol based, IoT and Robotics programming framework, developed by the Nodebots Community. Johnny-Five programs can be written for Arduino (all models), Electric Imp, Beagle Bone, Intel Galileo & Edison, Linino One, Pinoccio, pcDuino3, Raspberry Pi, Particle/Spark Core & Photon, Tessel 2, TI Launchpad and more!

Johnny-Five has grown from a passion project into a tool for inspiring learning and creativity for people of all ages, backgrounds, and from all across the world.

Just interested in learning and building awesome things? You might want to start with the official Johnny-Five website.

  • If you want to find the API documentation, that’s right here.
  • Need to figure out what platform to use for a project? We put that stuff here.
  • Need inspiration for your next NodeBot? Check out the examples.
  • Want to stay up-to-date with projects in the community? Check this out.
  • Need NodeBots community or Johnny-Five project updates and announcements? This is what you’re looking for.

Johnny-Five does not attempt to provide "all the things", but instead focuses on delivering robust, reality tested, highly composable APIs that behave consistently across all supported hardware platforms. Johnny-Five wants to be a baseline control kit for hardware projects, allowing you the freedom to build, grow and experiment with diverse JavaScript libraries of your own choice. Johnny-Five couples comfortably with:

...And that's only a few of the many explorable possibilities. Check out these exciting projects: node-pulsesensor, footballbot-workshop-ui, nodebotui, dublin-disco, node-slot-car-bot, servo-calibrator, node-ardx, nodebot-workshop, phone-home, purple-unicorn, webduino, leapduino, lasercat-workshop, simplesense, five-redbot, robotnik, the-blender

Why JavaScript? NodeBots: The Rise of JavaScript Robotics

Hello Johnny

The ubiquitous "Hello World" program of the microcontroller and SoC world is "blink an LED". The following code demonstrates how this is done using the Johnny-Five framework.

const { Board, Led } = require("johnny-five");
const board = new Board();

board.on("ready", () => {
  // Create an Led on pin 13
  const led = new Led(13);
  // Blink every half second
  led.blink(500);
});

Note: Node will crash if you try to run johnny-five in the node REPL, but board instances will create their own contextual REPL. Put your script in a file.

Supported Hardware

Johnny-Five has been tested on a variety of Arduino-compatible Boards.

For non-Arduino based projects, a number of platform-specific IO Plugins are available. IO Plugins allow Johnny-Five code to communicate with any non-Arduino based hardware in whatever language that platforms speaks!

Documentation

Documentation for the Johnny-Five API can be found here and example programs here.

Guidance

Need help? Ask a question on the NodeBots Community Forum. If you just have a quick question or are interested in ongoing design discussions, join us in the Johnny-Five Gitter Chat.

For step-by-step examples, including an electronics primer, check out Arduino Experimenter's Guide for NodeJS by @AnnaGerber

Here is a list of prerequisites for Linux, OSX or Windows.

Check out the bluetooth guide if you want to remotely control your robot.

Setup and Assemble Arduino

  • Recommended Starting Kit: Sparkfun Inventor's Kit
  • Download Arduino IDE
  • Plug in your Arduino or Arduino compatible microcontroller via USB
  • Open the Arduino IDE, select: File > Examples > Firmata > StandardFirmataPlus
    • StandardFirmataPlus is available in Firmata v2.5.0 or greater
  • Click the "Upload" button.

If the upload was successful, the board is now prepared and you can close the Arduino IDE.

For non-Arduino projects, each IO Plugin's repo will provide its own platform specific setup instructions.

Hey you, here's Johnny!

Source Code:

git clone git://github.com/rwaldron/johnny-five.git && cd johnny-five

npm install

npm package:

Install the module with:

npm install johnny-five

Example Programs

To get you up and running quickly, we provide a variety of examples for using each Johnny-Five component. One thing we’re especially excited about is the extensive collection of Fritzing diagrams you’ll find throughout the site. A huge part of doing any Johnny-Five project is handling the actual hardware, and we’ve included these as part of the documentation because we realised that instructions on how to write code to control a servo are insufficient without instructions on how to connect a servo!

To interactively navigate the examples, visit the Johnny-Five examples page on the official website. If you want to link directly to the examples in this repo, you can use one of the following links.

There are presently 362 example programs with code and diagrams!

Board

LED

LED: RGB

LED: Digits & Matrix

Servo

GPS

Servo Animation

Color

Motor

Stepper Motor

ESC & Brushless Motor

Button / Switch

Keypad

Relay

Shift Register

Infrared Reflectance

Proximity

Motion

Joystick

LCD

Compass/Magnetometer

Piezo

IMU/Multi

Sensors

Expander

Photon Weather Shield

Lego EVShield

Intel Edison + Grove IoT Kit

Grove IoT Kit (Seeed Studio)

Micro Magician V2

TinkerKit

Wii

Complete Bots / Projects

Component Plugin Template

IO Plugins

Many fragments. Some large, some small.

Make: JavaScript Robotics

Contributing

All contributions must adhere to the Idiomatic.js Style Guide, by maintaining the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

License

Copyright (c) 2012, 2013, 2014 Rick Waldron [email protected] Licensed under the MIT license. Copyright (c) 2014, 2015 The Johnny-Five Contributors Licensed under the MIT license.

johnny-five's People

Contributors

ajfisher avatar annagerber avatar bcjordan avatar bcueto1 avatar botverse avatar briangenisio avatar cotejp avatar derekwheee avatar divanvisagie avatar dnlup avatar dtex avatar fivdi avatar gnarf avatar islemaster avatar julianduque avatar lyzadanger avatar mcdonnelldean avatar mmerlin avatar monteslu avatar mwittig avatar nebrius avatar pierceray avatar protonk avatar reconbot avatar resseguie avatar rmurphey avatar rwaldron avatar ryanjgill avatar scottgonzalez avatar yakmoose avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

johnny-five's Issues

Unable to digitalRead from button

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

Offtopic: Analogpin to SQL-Based Database

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.

Setup instructions out of date?

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?

Add dual & quadruple H-Bridge contructor

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?

Windows - Serial Port Detection / Connection

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! )

shiftOut should be a method on board instances

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.

[Unable to run demo] - Firmata closes serial connection...

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...

throw error

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)

Enhancement: Relays

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)

Specify port in the board constructor

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.

RGB Led's

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

Could not install johnny five

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

Multiple five.Leds

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?

`current` used as variable name

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?

Basic example breaks when building from source

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.

only closes connection to board, serialport every other time

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!

'ready' never fired

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

Problems With Ping

/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)

at Timer.ontimeout (timers.js:223:14)

when i am using ping i get this error! , using the docs example!

Add 'rover' constructor based on Navigator example

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 :)

Bindings don't work on Raspberry Pi

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)

wii nunchuck does not emit directional events

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.

Specify port in the board constructor

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.

CU vs TTY on Linux

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

Fails to load serialport(.node?)

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)

Sonar range( lower, upper ) & (range, entry, detect) event

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
});

LCD module docs don't match canonical example

(...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.

ping not working

I see that ping requires a special build of Firmata. Are there more details on where to find the special build?

Ready event not fired

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

Scale is broken.

No idea why, but it's broken.

You asked me to file a bug, so here I am.

gamepad API based on serialport

I think it would be cool to control robots with a gamepad

There are many ways to do so:

  • Browsers (gamepad API form Mozilla or Chrome)
  • XNA Framework
  • pygame + pyserial
  • mono game
  • ....

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/

Just a Question to Rick

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.