iRobot Create Open Interface (OI) library
An API for interacting with an iRobot Create. Because robots are fun.
The iRobot Create provides a low-level serial protocol called the "Open Interface" (OI) documented here. What this library attempts to do is implement a simple and intuitive API on top of OI in node.js using the great serialport library.
npm install --save create-oi
After plugging in your Create USB cable you'll need to find out what serial port your operating system has assigned your Create.
$ dmesg | grep tty
On a mac:
$ ls /dev/tty.*
On a windows box, open device manager and look under "Ports":
C:\> mmc devmgmt.msc
In your code you'll probably want to start with these two lines:
var robot = ;robot;
Make sure to set your
serialport to the device name you found earlier.
On my mac for me this is
"/dev/tty.usbserial-A2001nf6". Yours will be different.
The API is event-based, meaning all the important stuff happens in event callbacks.
The first event you'll need to deal with is the
ready event which gets fired when
the module sucessfully connects to the Create over the serial port. Note that the
this context for all your callback handlers will be set to the
itself, so you can easily call
rotate or any other module method within a
callback. Several events such as
wheeldrop will contain information about
which specific sensor was triggered inside the event parameter passed into your
Working examples (provided you change the serial port) can be found in the examples directory.
See the API Reference on the wiki.