Blinkenlights Library for Processing
library is designed to export sketches to the Blinkenlights BML file format
. If you'd like to convert a load images to BML, please check out Dan Fraser's converter
- v1.3: added getVersion() to ensure that you're using the latest version :^)
- v1.2: added the showPreview(boolean show) method to BMLWriter. Unless you set this to true, you will not see a pixelated preview of your sketch. This is because enable the preview can cause the bad effects when you export. When you export your sketch, turn off the preview and the grid.
- v1.1: The library has been modified to use Dan Fraser's PacketSender library, which allows you to write network packets to a BlinkenServer. The BML writing class has been renamed from Blinkenlights to BMLWriter.
- The library can now overlay a grid and rectangles representing the windows of the Toronto City Hall by calling bl.showGrid(true). The grid will only appear if running with the native Stereoscope virtual matrix: 96x32.
- Download the library and documentation from GitHub.
- Unzip it and open the blinkenlights_processing folder.
- Move the Blinkenlights folder into your sketchbook folder (usually ~/Documents/Processing on a Mac or My Documents/processing on Windows).
- Start Processing.
- From the Sketch menu, choose Import Library -> Blinkenlights.
- In your setup() method, create a new Blinkenlights instance:
int frameDuration = 41; // 24 fps
BMLWriter bl = new BMLWriter(this, frameDuration);
bl.setTitle("My First Sketch");
Doing this will cause your sketch to look pixelated when you run it. If you are happy with how it looks, start writing it to a BML file by putting this in your setup() method:
If you would like to send your sketch directly to a BlinkenServer, first create a PacketSender and then pass it to the BMLWriter constructor:
PacketSender mySender = new PacketSender(this,"127.0.0.1",2323);
BMLWriter bl = new BMLWriter(this, 41, mySender);
When exporting to file or across the network, make sure that the grid and the preview are turned off, or it make cause the image to be exported with visual artifacts.
Here is a sample application, view it in action here
int x = 0;
BMLWriter bl = new BMLWriter(this, 41);
x += 5;
Several of these examples are adapted from sketches originally made by Daniel Shiffman
- This library may not work correctly if used from Eclipse. For some reason when you quit your sketch, the library isn't notified. This may result in malformed BML files, which can be easily fixed by hand.
- To avoid missing regions along the right and bottom borders of your sketch, make your sketch's width and height are a multiple of your x count and y count, respectively.
- This code is licensed under the GPL. Please contact Robin Senior at email@example.com if you would like to contribute any updates.