@alexthevdwp
Could someone @scanlime @focalintent @jlmeredith help me with some simple code. I'm very inspired by the Addressable LED with fadecandy but need some artwork and software questions answered and make more art. At the moment, I am connecting 8 strips of Ws2812b LEDs to a control board. I started with a Teensy 3.1 + Octo and have now switched to Fandecandy mounted on one of RGB123's Breakout-board for the Fadecandy. I now have the Fandecandy connected to 8 LED strips of 54 pixels each and am running the example from the Fadecandy-master example called: Strip64-dot. I changed the number of pixels in the strip to match my strip length of 54 neopixels but when I run an image file I notice that things don't aligne properly. Below is the latest code I've been playing with for days: could you please help make it right or let me know what I need to change, many thanks!
OPC opc;
PImage dot;
void setup()
{
size(800, 200);
// Load a sample image
dot = loadImage("alex02 color-dot.png");
// Connect to the local instance of fcserver
opc = new OPC(this, "127.0.0.1", 7890);
// Map one 54-LED strip to the center of the window
opc.ledStrip(0, 54, width/2, height/4 + 15, width / 54.0, 0, false);
opc.ledStrip(55, 54, width/2, height/4 + 25, width / 54.0, 0, false);
opc.ledStrip(109, 54, width/2, height/4 + 35, width / 54.0, 0, false);
opc.ledStrip(163, 54, width/2, height/4 + 45, width / 54.0, 0, false);
opc.ledStrip(217, 54, width/2, height/4 + 55, width / 54.0, 0, false);
opc.ledStrip(271, 54, width/2, height/4 + 65, width / 54.0, 0, false);
opc.ledStrip(325, 54, width/2, height/4 + 75, width / 54.0, 0, false);
opc.ledStrip(379, 54, width/2, height/4 + 85, width / 54.0, 0, false);
}
void draw()
{
background(0);
// Draw the image, centered at the mouse location
float dotSize = width * 0.2;
image(dot, mouseX - dotSize/2, mouseY - dotSize/2, dotSize, dotSize);
} @focalintent @focalintent @focalintent @focalintent
// Set the location of several LEDs arranged in a strip.
// Angle is in radians, measured clockwise from +X.
// (x,y) is the center of the strip.
void ledStrip(int index, int count, float x, float y, float spacing, float angle, boolean reversed)
{
float s = sin(angle);
float c = cos(angle);
for (int i = 0; i < count; i++) {
led(reversed ? (index + count - 1 - i) : (index + i),
(int)(x + (i - (count-1)/2.0) * spacing * c + 0.5),
(int)(y + (i - (count-1)/2.0) * spacing * s + 0.5));
}
{
size(600, 600);
// Load a sample image
im = loadImage("flames.jpeg");
// Connect to the local instance of fcserver
opc = new OPC(this, "InMiCoTA", 7890);
float spaceAll = width/100;
for (int i = 0; i < 120; i++)
opc.ledStrip( 0, 22, (width/2)-((spaceAll*21)/2), (height/2)-(spaceAll*9), spaceAll, 0, true); //Bottom Led Addresses, Right
opc.ledStrip(22, 17, (width/2)-(spaceAll*21), (height/2), spaceAll, 3*PI/2, true); //Right Led Addresses
opc.ledStrip(39, 43, (width/2), (height/2)+(spaceAll*9), spaceAll, PI, true); //Top Led Addresses
opc.ledStrip(82, 17, (width/2)+(spaceAll*21), (height/2), spaceAll, (PI)/2, true); //Left Led Addresses
opc.ledStrip(99, 21, (width/2)+((spaceAll*22)/2), (height/2)-(spaceAll*9), spaceAll, 0, true); //Bottom Led Addresses, Left
}
Great I finally got it thanks to ur help @M-I-Kessler and @focalintent > here is the code that works: // Map one 54-LED strip to the center of the window
for (int i = 0; i < 8; i++)
opc.ledStrip(0, 54, width/2, height/4 + 15, width / 54.0, 0, false);
opc.ledStrip(64, 54, width/2, height/4 + 25, width / 54.0, 0, false);
opc.ledStrip(128, 54, width/2, height/4 + 35, width / 54.0, 0, false);
opc.ledStrip(192, 54, width/2, height/4 + 45, width / 54.0, 0, false);
opc.ledStrip(256, 54, width/2, height/4 + 55, width / 54.0, 0, false);
opc.ledStrip(320, 54, width/2, height/4 + 65, width / 54.0, 0, false);
opc.ledStrip(384, 54, width/2, height/4 + 75, width / 54.0, 0, false);
opc.ledStrip(448, 54, width/2, height/4 + 85, width / 54.0, 0, false);
}