monode
monome grid/arc toolkit
Monode makes monome device discovery/interaction trivial and fun. lol wut?
Getting Started
$ npm install monode
$ node
> monode = require('monode')();
// now plug your monome grid in
> monode.grid.led(0, 0, 1);
// now plug your arc in
> monode.arc.led(0, 0, 1); // turn on
> monode.arc.level(0, 1, 8); // set level
Getting Started With Better Practices
monode emits a 'device' event when a monome device is ready to use.
- "device" triggers after a device is connected via usb
- "device" triggers once for each connected device after
monodeInit
is called for the first time
// light grid led on key pressvar monodeInit = ;var monode = ; monode;
Connected devices also accessible through the monode.devices object
console;
Documentation
Device Methods
device.led(x, y, state)
// turn on led at position 0, 4device;// turn off againdevice;
device.level(x, y, intensity)
// set led level IF the device supports itdevice
device.close()
// close the server listening for messages from the device// in most cases, you won't need this as it will happen// automagically when you exit node.jsdevice
device.osc.send(address, val1, val2, ...)
// send arbitrary osc message to serialoscdeviceosc;
Device Properties
// Read-only propertiesdevicewidth // integer - for arc, this is the same as sizedeviceheight // integer - for arc this is always 64devicehost // stringdeviceport // integerdeviceid // string ex: "m0000164"devicetype // string ex: "monome arc 2", "monome 64"deviceisArc // booldeviceready // booldevicesize // integer, arc only, 2 or 4deviceosc // [node-osc Client](https://github.com/TheAlphaNerd/node-osc) // Assignable propertiesdevicerotation // integer - grid only - 0, 90, 180, or 270deviceprefix // string - set or get // Assignable properties update asynchronously.// An event will be fired when when the update occurs.// Set rotation by assigning 0, 90, 180, 270> device;> console;90> devicerotation = 180; console;90rotation changed to: 180
Device Events
enc
// arc encoder deltadevice;
key
// grid and arc 2011device;
tilt
// arc or griddevice;
disconnect
// similar to the monode "disconnect" eventdevice;
prefix and rotation
// prefix and rotation work the same waydevice;
ready
// ready is similar to the monode "device" event// use the monode "device" event to get devices...device;
monode Properties
monode.grid
A convenience property -- the most recently added monome grid. Usefull when fooling around in the console.
monode.arc
A convenience property -- the most recently added monome arc.
monode Events
device
// triggered once the device has configured itself with width, height, etcmonode;
connect
// not recomended - just use "device" insteadmonode;
disconnect
monode
Misc
Requires serialosc 1.2a or later. Serialosc 1.4 or later recommended
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
Release History
- 3.0.1 syntax highlighting in readme
- 3.0.0
- Uses
127.0.0.1
instead oflocalhost
and0.0.0.0
for all ports - Tested with serialosc 1.4
- Osc.server never tries to open the same port twice
- Small bugfixes
- Uses
- 2.2.3 Slightly faster device detection
- 2.2.2 Smarter detection of open UDP ports
- 2.2.0 Add monode.grid and monode.arc convenience properties
- 2.1.1 Improve documentation
- 2.1.0 add device.level method for arc and grid
- 2.0.0 rename node-monome to monode
- 1.1.2 Better Readme
- 1.1.1 Bugfixes
- 1.1.0 Add Arc Support
License
Copyright (c) 2013 Charles Holbrow
Licensed under the MIT license.