Skip to content

Instantly share code, notes, and snippets.

@jasoncoon
Created December 25, 2014 20:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasoncoon/42dc985a6dbf166dd203 to your computer and use it in GitHub Desktop.
Save jasoncoon/42dc985a6dbf166dd203 to your computer and use it in GitHub Desktop.
BlinkyTile Simple Cycle Example
// The simplest possible way to talk to a BlinkyTape
import processing.serial.*;
Serial s;
void setup() {
// Connect to the first serial port we can find
// We assume there is a BlinkyTape there
s = new Serial(this, "COM6", 115200);
}
int index = 0;
void draw() {
for (int i = 0; i < 12; i++) {
// Make up a pretty color based on the current phase
color c = color(0, 0, 0);
if (i == index)
c = color(254, 0, 0);
// Send the color for the current LED to the strip,
// being careful not to send 255 (because that would
// cause the strip to display the pixels
s.write((byte)min(254, red(c)));
s.write((byte)min(254, green(c)));
s.write((byte)min(254, blue(c)));
}
// Send a 0xFF byte to the strip, to tell it to display the pixels
s.write((byte)255);
delay(8);
index++;
if (index >= 12)
index = 0;
}
@jasoncoon
Copy link
Author

This is a simple Processing sketch to control a BlinkyTile via Processing. Based on (and slightly modified from) "The Simplest BlinkyTape Program" at http://blinkinlabs.com/blinkytape/processing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment