0.9.4 • Published 5 years ago

nodejs-nxt v0.9.4

Weekly downloads
2
License
GPLv3
Repository
github
Last release
5 years ago

nodejs-nxt

nodejs-nxt is a Node.js package to control the LEGO MINDSTORMS NXT with an USB cable or a Bluethooth connection.

How I did it

I used the official communication protocol, which communicates with the nxt over its serial port. You can find the documentation here.

How to install

Nodejs-nxt could be installed with a simple

$ npm install nodejs-nxt

Usage example

The following example code connects with the NXT through the serial port '/dev/tty.NXT-DevB', plays a tone with 1000 Hz for 2 seconds and then disconnects.

var nxt = require('nodejs-nxt');
var nxt0 = new nxt.NXT('/dev/tty.NXT-DevB', true);

nxt0.Connect(function(error) {
  if (error) {
    console.log('Could not connect to the device!');
  } else {
    nxt0.PlayTone(1000, 2000, function(error) {
      if (error) {
        console.log('Could not play the tone!');
      }

      nxt0.Disconnect();
    });
  }
});

Dependancy

Nodejs-nxt needs the package node-serialport to communicate with the NXT.

Known bugs

  • The ultrasonic-sensor doesn't work yet

To do

  • Fix bugs (see above)
  • API documentation
  • Add system commands
  • Add another layer of functions for ease of use

Contributors

@maoberlehner has done all the work for version 0.9.3

License

GPLv3

0.9.4

5 years ago

0.9.2

8 years ago

0.9.1

8 years ago

0.9.0

8 years ago