node package manager
Easy collaboration. Discover, share, and reuse code in your team. Create a free org »

finch-robot

finch-robot

A library for controlling Finch Robots with Node.JS.

This library is still in development and not considered stable.

Usage

node-finch-robot uses the node-hid library to communicate with the USB device. node-hid requires system level dependencies in order to control the USB device. On Linux you'll need libudev-dev or for Ubuntu versions missing libusb.h, you'll need libusb-1.0-0-dev. Now require the module and initialise an instance.

Ubuntu Users: sudo apt-get install -y libusb-1.0-0-dev

var finch = require('finch-robot');
var device = finch();

If there's an issue finding or connecting to the device an error will be thrown by the second line.

After you have a device successfully initialised you can issue the Finch commands...

LEDs

device.led(r, g, b)
  • r, g, b = [0-255] - Red, Green, Blue

Moving

device.move(leftDirection, leftSpeed, rightDirection, rightSpeed)
device.move(leftSpeed, rightSpeed) // Direction assumed forward 
  • leftDirection/rightDirection = [0|1] - 0 is forward, 1 is backwards
  • leftSpeed/rightSpeed = [0-255] - 0 is stopped, 255 is fast

Turn off Motors and LEDs

device.turnOffMotorAndLEDs()

Enter Idle Mode

This will make the Finch's LED colour cycle.

device.setIdleMode()

TODO

These commands are either not implemented or not working quite yet.

Buzzer

TODO

Temperature

device.temperature(callback)

Light

device.light(callback)

Accelerometer

device.accelerometer(callback)

Development Resources

Licence

MIT