This is going to be a small guide for using the [NeoPixels](https://www.adafruit.com/category/168) together with the [Fadecandy](https://github.com/scanlime/fadecandy) controller. We are going to use a single 8x8 NeoPixel board and a single Fadecandy controller.
## Components
We are going to use very few components:
- 1x Adafruit NeoPixel 8x8
- 1x Fadecandy
- 4x Jumper cables (male to male)
- Header pins
- Breadboard
- Mini USB cable
- Power Supply
## Soldering
This is a one time thing and I just did it to make the NeoPixels easier to use later on.
Take the header pins and put them so you have two sets of 3 pins and two sets of 2 pins.
Next solder the two sets of 2 pins on the GPIO pin 0 and 7 on the Fadecandy. We are actually just going to use one of the ports (GPIO pin 0) but if we have header pins on both 0 and 7, it will be better fastened to the breadboard.
We connect the top port (blue) on the GPIO port 0 to the DIN (input) pin on the NeoPixel matrix. The bottom port (black) to the ground pin on the NeoPixel and that's all for connecting the NeoPixels to the Fadecandy.
We are now going to need some power. There are two options, if we are just running a single board we can use USB power. So for this we need a USB cable with header pins in one end (as seen on the picture below).
Attach the cable to the board and attach a black jumper cable from ground on the USB cable to ground on the NeoPixels, and a red jumper cable from the power on the USB cable to the 5v input on the NeoPixels.
Download the Fadecandy software from their GitHub site [link](https://github.com/scanlime/fadecandy) and extract it somewhere on your computer.
Open the terminal (OS X/Linux) or command line (Windows) and go to your downloaded folder.
cd ~/Downloads/fadecandy-master
Inside that folder we need to go to the bin folder.
cd bin
Now we can run the fadecandy server depending on our platform. I'm using OS X.
open fcserver-osx
Connect the fadecandy to the computer using the mini USB cable and it should now be registered.
Open up the folder called `examples/processing/grid8x8\_dot` and open the processing sketch `grid8x8\_dot.pde` with Processing. Run it and the fadecandy should have a green light on and Processing should look like this
Connect the USB power to your computer and you should now be able to move your mouse around in the Processing sketch and change the light on the NeoPixel matrix.
If you don't have a USB cable with header pins on you can use a regular 5V ~2A power supply. Connect the ground and 5V pin from the NeoPixel matrix to the power supply and run the Processing sketch for the same result.
Here the important part is the ledGrid8x8 line. First we have a 0, this indicated that we have connected the led matrix to connector 0 on the fadecandy. Next we need to define the center of the matrix. This is done using `width/2` and `height/2`. We also need to define the spacing between each LED. The spacing is approximately one LED in size, so we can use `height/16`. The next 0 is the rotation. Since we just use the default rotation we dont need to change this. `false` means that all the LEDs point in the same direction.
If we run this nothing will really happen except we get a black screen with 8x8 dots on.
We can change the individual colors using `setPixel(index, color)` in the draw function.
Unfortunately each pixel does have a bit of color bleeding to nearby pixels, this can be prevented using a printed separator or another time of plate in front.
Here is you you can identify the Fadecandy if multiple ones are connected or test all the LEDs. There is also an option to configure the server using JSON, but that’s not something I want to get into now.
It is also possible to connect LED stips of various length to the fadecandy. It is basically the same as using a matrix but to initialize the stip we are using:
First we have the index, since this is the first row of pixels we just use 0 as index. Here we just say the length is 64 pixels, with a midpoint the same as the grid. The spacing is a bit different, but with 64 pixels `width/70` should work. `0` is again the rotation and false specify to direction.
It's straightforward to change individual pixels and in order to use images as source for the pattern, the fadecandy examples are a good source of information.