Blinkenlights Library for Processing

This 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.

Updates

Installation Instructions

Usage Instructions

int frameDuration = 41; // 24 fps

BMLWriter bl = new BMLWriter(this, frameDuration);

// optionally set the grid dimensions (default is 96x32)
bl.setCountX(5);
bl.setCountY(10);

// optionally set your details for the credits
bl.setAuthor("Robin Senior");
bl.setTitle("My First Sketch");
bl.setEmail("senior@gmail.com");
bl.setURL("www.robinsenior.com");
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:
bl.startWriting("circle.bml");
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);
ATTENTION: 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:
import processing.blinkenlights.*;

int x = 0;

void setup()
{
     // instantiate the Blinkenlights library
     BMLWriter bl = new BMLWriter(this, 41);

     //only use the grid for testing

     //bl.showGrid(true);
     bl.setAuthor("Robin Senior");
     bl.setTitle("Crappy Circle");
     bl.setEmail("senior@gmail.com");
     bl.setURL("www.robinsenior.com");

     // set up your sketch
     size(960, 320);
     frameRate(30);
     colorMode(RGB,255);
     smooth();
     noStroke();

     // this is where the magic happens
     bl.startWriting("circle.bml");
}

// do your own thing
void draw()
{
     background(0);
     fill(255);
     ellipse(x,height/2,150,150);
     ellipse(width-x,height/2,150,150);

     x += 5;

     if (x>width)
          x=0;
}

Gallery

Several of these examples are adapted from sketches originally made by Daniel Shiffman.

Notes