IP Configuration
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
//----------------------------------------------------------------------
|
||||
// NeoPixelMosaicDump
|
||||
// This will dump to the serial output a grid map of the defined mosaic
|
||||
// The output is displayed as row column labeled grid with the NeoPixelBus
|
||||
// index of the pixel at the intersection of the row and column.
|
||||
//
|
||||
// To help with physical layout, there maybe included a symbol following the index
|
||||
// < means the index is the input index for the panel, the first on the panel
|
||||
// > means the index is the output index for the panel, the last on the panel
|
||||
//
|
||||
// This is useful in visualising the mosaic layout of your panels to
|
||||
// confirm you have them correctly wired together for this mosaic pattern
|
||||
//
|
||||
// It does not require that you have the actual panel connected
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#include <NeoPixelAnimator.h>
|
||||
#include <NeoPixelBus.h>
|
||||
|
||||
// uncomment one of these that matches your panel pixel layouts
|
||||
// rotation is ignored for mosaic as it applies a rotation for you
|
||||
// that is specific to the location of the panel within the mosaic
|
||||
// to reduce connection lengths
|
||||
|
||||
typedef ColumnMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef ColumnMajorLayout MyPanelLayout;
|
||||
// typedef RowMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef RowMajorLayout MyPanelLayout;
|
||||
|
||||
// make sure to set these panel and tile layout to match your sizes
|
||||
const uint8_t PanelWidth = 8; // a 8 pixel x 8 pixel matrix of leds on the panel
|
||||
const uint8_t PanelHeight = 8;
|
||||
const uint8_t TileWidth = 4; // laid out in 4 panels x 2 panels mosaic
|
||||
const uint8_t TileHeight = 2;
|
||||
|
||||
NeoMosaic <MyPanelLayout> mosaic(
|
||||
PanelWidth,
|
||||
PanelHeight,
|
||||
TileWidth,
|
||||
TileHeight);
|
||||
|
||||
void DumpMosaic()
|
||||
{
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t\t");
|
||||
for (int x = 0; x < mosaic.getWidth(); x++)
|
||||
{
|
||||
Serial.print(x);
|
||||
Serial.print("\t");
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t---");
|
||||
for (int x = 0; x < mosaic.getWidth(); x++)
|
||||
{
|
||||
Serial.print("--------");
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
for (int y = 0; y < mosaic.getHeight(); y++)
|
||||
{
|
||||
Serial.print(" ");
|
||||
Serial.print(y);
|
||||
Serial.print("\t|\t");
|
||||
|
||||
for (int x = 0; x < mosaic.getWidth(); x++)
|
||||
{
|
||||
NeoTopologyHint hint = mosaic.TopologyHint(x, y);
|
||||
|
||||
Serial.print(mosaic.Map(x, y));
|
||||
if (hint == NeoTopologyHint_FirstOnPanel)
|
||||
{
|
||||
Serial.print("<");
|
||||
}
|
||||
else if (hint == NeoTopologyHint_LastOnPanel)
|
||||
{
|
||||
Serial.print(">");
|
||||
}
|
||||
Serial.print("\t");
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); // wait for serial attach
|
||||
|
||||
DumpMosaic();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
//----------------------------------------------------------------------
|
||||
// NeoPixelTopologyTest
|
||||
// This will display specific colors in specific locations on the led panels
|
||||
//
|
||||
// This is useful in confirming the layout of your panels
|
||||
//
|
||||
// It does require that you have the actual panels connected
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#include <NeoPixelAnimator.h>
|
||||
#include <NeoPixelBus.h>
|
||||
|
||||
// uncomment one of these that matches your panel pixel layouts
|
||||
// rotation is ignored for mosaic as it applies a rotation for you
|
||||
// that is specific to the location of the panel within the mosaic
|
||||
// to reduce connection lengths
|
||||
|
||||
typedef ColumnMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef ColumnMajorLayout MyPanelLayout;
|
||||
// typedef RowMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef RowMajorLayout MyPanelLayout;
|
||||
|
||||
// make sure to set these panel values to the sizes of yours
|
||||
const uint8_t PanelWidth = 8; // 8 pixel x 8 pixel matrix of leds
|
||||
const uint8_t PanelHeight = 8;
|
||||
const uint8_t TileWidth = 4; // laid out in 4 panels x 2 panels mosaic
|
||||
const uint8_t TileHeight = 2;
|
||||
|
||||
const uint16_t PixelCount = PanelWidth * PanelHeight * TileWidth * TileHeight;
|
||||
const uint8_t PixelPin = 2;
|
||||
|
||||
NeoMosaic <MyPanelLayout> mosaic(
|
||||
PanelWidth,
|
||||
PanelHeight,
|
||||
TileWidth,
|
||||
TileHeight);
|
||||
|
||||
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
// for esp8266 omit the pin
|
||||
//NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount);
|
||||
|
||||
RgbColor red(128, 0, 0);
|
||||
RgbColor green(0, 128, 0);
|
||||
RgbColor blue(0, 0, 128);
|
||||
RgbColor white(128);
|
||||
// if using NeoRgbwFeature above, use this white instead to use
|
||||
// the correct white element of the LED
|
||||
//RgbwColor white(128);
|
||||
RgbColor black(0);
|
||||
|
||||
const uint16_t left = 0;
|
||||
const uint16_t right = PanelWidth - 1;
|
||||
const uint16_t top = 0;
|
||||
const uint16_t bottom = PanelHeight - 1;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); // wait for serial attach
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Initializing...");
|
||||
|
||||
strip.Begin();
|
||||
strip.Show();
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Running...");
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
delay(2500);
|
||||
|
||||
Serial.println();
|
||||
Serial.println("If your panel is correctly defined, you should see ...");
|
||||
Serial.println("Upper left is white.");
|
||||
Serial.println("Upper right is Red.");
|
||||
Serial.println("Lower right is Green");
|
||||
Serial.println("Lower Left is Blue");
|
||||
|
||||
// use the topo to map the 2d cordinate to the pixel
|
||||
// and use that to SetPixelColor
|
||||
strip.SetPixelColor(mosaic.Map(left, top), white);
|
||||
strip.SetPixelColor(mosaic.Map(right, top), red);
|
||||
strip.SetPixelColor(mosaic.Map(right, bottom), green);
|
||||
strip.SetPixelColor(mosaic.Map(left, bottom), blue);
|
||||
strip.Show();
|
||||
|
||||
delay(5000);
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Cleared to black ...");
|
||||
strip.ClearTo(black);
|
||||
strip.Show();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
//----------------------------------------------------------------------
|
||||
// NeoPixelRingTopologyTest
|
||||
// This will display specific colors in specific locations on the led rings
|
||||
//
|
||||
// This is useful in confirming the layout of your rings
|
||||
//
|
||||
// It does require that you have the actual series of rings connected
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#include <NeoPixelBus.h>
|
||||
|
||||
const uint8_t PixelCount = 119;
|
||||
const uint8_t PixelPin = 2; // make sure to set this to the correct pin, ignored for Esp8266
|
||||
|
||||
// define the layout of your series of rings
|
||||
//
|
||||
// This example is using all of Adafruits rings and a Jewel in the center.
|
||||
// The center is the input and all the rings are connected in series going outward
|
||||
//
|
||||
// Rings:
|
||||
// 0 - 1 (virtual ring, the center of the jewel)
|
||||
// 1 - 6 (virtual ring, the outer ring of the jewel)
|
||||
// 2 - 12 count ring
|
||||
// 3 - 16 count ring
|
||||
// 4 - 24 count ring
|
||||
// 5 - 60 count ring comprised of four arc segments
|
||||
//
|
||||
// The values below in Rings[] are the index of the first pixel in each ring.
|
||||
// An extra value is appended for a virtual ring start that also
|
||||
// represents the total count of pixels in the complete series and this extra
|
||||
// value is required.
|
||||
//
|
||||
class MyRingsLayout
|
||||
{
|
||||
protected:
|
||||
const uint16_t Rings[7] = {0, 1, 7, 19, 35, 59, PixelCount};
|
||||
};
|
||||
|
||||
// use the MyRingsLayout to declare the topo object
|
||||
//
|
||||
NeoRingTopology<MyRingsLayout> topo;
|
||||
|
||||
// declare our strip
|
||||
//
|
||||
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
|
||||
// define some handy colors
|
||||
//
|
||||
RgbColor red(128, 0, 0);
|
||||
RgbColor green(0, 128, 0);
|
||||
RgbColor blue(0, 0, 128);
|
||||
RgbColor black(0);
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); // wait for serial attach
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Initializing...");
|
||||
|
||||
strip.Begin();
|
||||
strip.Show();
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Running...");
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
delay(2500);
|
||||
|
||||
Serial.println();
|
||||
Serial.println("If your panel is correctly defined, you should see ...");
|
||||
Serial.println("First pixel in each ring is Red.");
|
||||
Serial.println("Middle pixel in each ring is Green.");
|
||||
Serial.println("Last Pixel in each ring is Blue.");
|
||||
|
||||
|
||||
// use the topo to map the 2d polar cordinate to the pixel
|
||||
// and use that to SetPixelColor
|
||||
for (uint16_t ring = 0; ring < topo.getCountOfRings(); ring++)
|
||||
{
|
||||
// first pixel in each ring is red
|
||||
strip.SetPixelColor(topo.Map(ring, 0), red);
|
||||
// last pixel in each ring is blue
|
||||
strip.SetPixelColor(topo.Map(ring, topo.getPixelCountAtRing(ring) - 1), blue);
|
||||
// middle pixel in each ring is green
|
||||
strip.SetPixelColor(topo.Map(ring, topo.getPixelCountAtRing(ring) / 2), green);
|
||||
}
|
||||
strip.Show();
|
||||
|
||||
delay(5000);
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Cleared to black ...");
|
||||
strip.ClearTo(black);
|
||||
strip.Show();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
//----------------------------------------------------------------------
|
||||
// NeoPixelTileDump
|
||||
// This will dump to the serial output a grid map of the defined tiles
|
||||
// The output is displayed as row column labeled grid with the NeoPixelBus
|
||||
// index of the pixel at the intersection of the row and column
|
||||
//
|
||||
// To help with physical layout, there maybe included a symbol following the index
|
||||
// < means the index is the input index for the panel, the first on the panel
|
||||
// > means the index is the output index for the panel, the last on the panel
|
||||
//
|
||||
// This is useful in visualising the tile layout of your panels to
|
||||
// confirm you have them correctly wired together for the defined pattern
|
||||
//
|
||||
// It does not require that you have the actual panel connected
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#include <NeoPixelAnimator.h>
|
||||
#include <NeoPixelBus.h>
|
||||
|
||||
// uncomment one of these that matches your panel pixel layouts and
|
||||
// how you want them rotated. Not all the rotations are listed here
|
||||
// but you can modifiy the name to include the rotation of 90,180, or 270.
|
||||
|
||||
typedef ColumnMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef ColumnMajorLayout MyPanelLayout;
|
||||
// typedef RowMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef RowMajorLayout MyPanelLayout;
|
||||
// typedef RowMajor90Layout MyPanelLayout; // note rotation 90 was used
|
||||
|
||||
// change this to be one of the layouts which will define the layout
|
||||
// of the panels themselves
|
||||
typedef ColumnMajorLayout MyTilesLayout;
|
||||
|
||||
// make sure to set these panel and tile layout to match your sizes
|
||||
const uint8_t PanelWidth = 8; // 8 pixel x 8 pixel matrix of leds
|
||||
const uint8_t PanelHeight = 8;
|
||||
const uint8_t TileWidth = 4; // laid out in 4 panels x 2 panels mosaic
|
||||
const uint8_t TileHeight = 2;
|
||||
|
||||
NeoTiles <MyPanelLayout, MyTilesLayout> tiles(
|
||||
PanelWidth,
|
||||
PanelHeight,
|
||||
TileWidth,
|
||||
TileHeight);
|
||||
|
||||
void DumpTopo()
|
||||
{
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t\t");
|
||||
for (int x = 0; x < tiles.getWidth(); x++)
|
||||
{
|
||||
Serial.print(x);
|
||||
Serial.print("\t");
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t---");
|
||||
for (int x = 0; x < tiles.getWidth(); x++)
|
||||
{
|
||||
Serial.print("--------");
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
for (int y = 0; y < tiles.getHeight(); y++)
|
||||
{
|
||||
Serial.print(" ");
|
||||
Serial.print(y);
|
||||
Serial.print("\t|\t");
|
||||
|
||||
for (int x = 0; x < tiles.getWidth(); x++)
|
||||
{
|
||||
NeoTopologyHint hint = tiles.TopologyHint(x, y);
|
||||
|
||||
Serial.print(tiles.Map(x, y));
|
||||
if (hint == NeoTopologyHint_FirstOnPanel)
|
||||
{
|
||||
Serial.print("<");
|
||||
}
|
||||
else if (hint == NeoTopologyHint_LastOnPanel)
|
||||
{
|
||||
Serial.print(">");
|
||||
}
|
||||
Serial.print("\t");
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); // wait for serial attach
|
||||
|
||||
DumpTopo();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
//----------------------------------------------------------------------
|
||||
// NeoPixelTilesTest
|
||||
// This will display specific colors in specific locations on the led panels
|
||||
//
|
||||
// This is useful in confirming the layout of your panels
|
||||
//
|
||||
// It does require that you have the actual panels connected
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#include <NeoPixelAnimator.h>
|
||||
#include <NeoPixelBus.h>
|
||||
|
||||
// uncomment one of these that matches your panel pixel layouts and
|
||||
// how you want them rotated. Not all the rotations are listed here
|
||||
// but you can modifiy the name to include the rotation of 90,180, or 270.
|
||||
|
||||
typedef ColumnMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef ColumnMajorLayout MyPanelLayout;
|
||||
// typedef RowMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef RowMajorLayout MyPanelLayout;
|
||||
// typedef RowMajor90Layout MyPanelLayout; // note rotation 90 was used
|
||||
|
||||
// change this to be one of the layouts which will define the layout
|
||||
// of the panels themselves
|
||||
typedef ColumnMajorLayout MyTilesLayout;
|
||||
|
||||
// make sure to set these panel values to the sizes of yours
|
||||
const uint8_t PanelWidth = 8; // 8 pixel x 8 pixel matrix of leds
|
||||
const uint8_t PanelHeight = 8;
|
||||
const uint8_t TileWidth = 4; // laid out in 4 panels x 2 panels mosaic
|
||||
const uint8_t TileHeight = 2;
|
||||
|
||||
const uint16_t PixelCount = PanelWidth * PanelHeight * TileWidth * TileHeight;
|
||||
const uint8_t PixelPin = 2;
|
||||
|
||||
NeoTiles <MyPanelLayout, MyTilesLayout> tiles(
|
||||
PanelWidth,
|
||||
PanelHeight,
|
||||
TileWidth,
|
||||
TileHeight);
|
||||
|
||||
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
//NeoPixelBus<NeoRgbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
//NeoPixelBus<NeoRgbwFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
// for esp8266 omit the pin
|
||||
//NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount);
|
||||
|
||||
RgbColor red(128, 0, 0);
|
||||
RgbColor green(0, 128, 0);
|
||||
RgbColor blue(0, 0, 128);
|
||||
RgbColor white(128);
|
||||
// if using NeoRgbwFeature above, use this white instead to use
|
||||
// the correct white element of the LED
|
||||
//RgbwColor white(128);
|
||||
RgbColor black(0);
|
||||
|
||||
const uint16_t left = 0;
|
||||
const uint16_t right = PanelWidth - 1;
|
||||
const uint16_t top = 0;
|
||||
const uint16_t bottom = PanelHeight - 1;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); // wait for serial attach
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Initializing...");
|
||||
|
||||
strip.Begin();
|
||||
strip.Show();
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Running...");
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
delay(2500);
|
||||
|
||||
Serial.println();
|
||||
Serial.println("If your panel is correctly defined, you should see ...");
|
||||
Serial.println("Upper left is white.");
|
||||
Serial.println("Upper right is Red.");
|
||||
Serial.println("Lower right is Green");
|
||||
Serial.println("Lower Left is Blue");
|
||||
|
||||
// use the topo to map the 2d cordinate to the pixel
|
||||
// and use that to SetPixelColor
|
||||
strip.SetPixelColor(tiles.Map(left, top), white);
|
||||
strip.SetPixelColor(tiles.Map(right, top), red);
|
||||
strip.SetPixelColor(tiles.Map(right, bottom), green);
|
||||
strip.SetPixelColor(tiles.Map(left, bottom), blue);
|
||||
strip.Show();
|
||||
|
||||
delay(5000);
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Cleared to black ...");
|
||||
strip.ClearTo(black);
|
||||
strip.Show();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
//----------------------------------------------------------------------
|
||||
// NeoPixelTopologyDump
|
||||
// This will dump to the serial output a grid map of the defined topology
|
||||
// The output is displayed as row column labeled grid with the NeoPixelBus
|
||||
// index of the pixel at the intersection of the row and column
|
||||
//
|
||||
// This is useful in visualising the layout of your panel so you can
|
||||
// confirm you have the correct pattern
|
||||
//
|
||||
// It does not require that you have the actual panel connected
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#include <NeoPixelAnimator.h>
|
||||
#include <NeoPixelBus.h>
|
||||
|
||||
// uncomment one of these that matches your panel pixel layouts and
|
||||
// how you want them rotated. Not all the rotations are listed here
|
||||
// but you can modifiy the name to include the rotation of 90,180, or 270.
|
||||
|
||||
typedef ColumnMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef ColumnMajorLayout MyPanelLayout;
|
||||
// typedef RowMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef RowMajorLayout MyPanelLayout;
|
||||
// typedef RowMajor90Layout MyPanelLayout; // note rotation 90 was used
|
||||
|
||||
// make sure to set these panel values to the sizes of yours
|
||||
const uint8_t PanelWidth = 8; // 8 pixel x 8 pixel matrix of leds
|
||||
const uint8_t PanelHeight = 8;
|
||||
|
||||
NeoTopology<MyPanelLayout> topo(PanelWidth, PanelHeight);
|
||||
|
||||
void DumpTopo()
|
||||
{
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t\t");
|
||||
for (int x = 0; x < topo.getWidth(); x++)
|
||||
{
|
||||
Serial.print(x);
|
||||
Serial.print("\t");
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
Serial.print("\t--");
|
||||
for (int x = 0; x < topo.getWidth(); x++)
|
||||
{
|
||||
Serial.print("--------");
|
||||
}
|
||||
Serial.println();
|
||||
|
||||
for (int y = 0; y < topo.getHeight(); y++)
|
||||
{
|
||||
Serial.print(" ");
|
||||
Serial.print(y);
|
||||
Serial.print("\t|\t");
|
||||
|
||||
for (int x = 0; x < topo.getWidth(); x++)
|
||||
{
|
||||
Serial.print(topo.Map(x, y));
|
||||
Serial.print("\t");
|
||||
}
|
||||
Serial.println();
|
||||
}
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); // wait for serial attach
|
||||
|
||||
DumpTopo();
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
//----------------------------------------------------------------------
|
||||
// NeoPixelTopologyTest
|
||||
// This will display specific colors in specific locations on the led panel
|
||||
//
|
||||
// This is useful in confirming the layout of your panel
|
||||
//
|
||||
// It does require that you have the actual panel connected
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#include <NeoPixelAnimator.h>
|
||||
#include <NeoPixelBus.h>
|
||||
|
||||
// uncomment one of these that matches your panel pixel layouts and
|
||||
// how you want them rotated. Not all the rotations are listed here
|
||||
// but you can modifiy the name to include the rotation of 90,180, or 270.
|
||||
|
||||
typedef ColumnMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef ColumnMajorLayout MyPanelLayout;
|
||||
// typedef RowMajorAlternatingLayout MyPanelLayout;
|
||||
// typedef RowMajorLayout MyPanelLayout;
|
||||
// typedef RowMajor90Layout MyPanelLayout; // note rotation 90 was used
|
||||
|
||||
// make sure to set these panel values to the sizes of yours
|
||||
const uint8_t PanelWidth = 8; // 8 pixel x 8 pixel matrix of leds
|
||||
const uint8_t PanelHeight = 8;
|
||||
const uint16_t PixelCount = PanelWidth * PanelHeight;
|
||||
const uint8_t PixelPin = 2; // make sure to set this to the correct pin, ignored for Esp8266
|
||||
|
||||
NeoTopology<MyPanelLayout> topo(PanelWidth, PanelHeight);
|
||||
|
||||
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
//NeoPixelBus<NeoRgbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
//NeoPixelBus<NeoRgbwFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
// for esp8266 omit the pin
|
||||
//NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount);
|
||||
|
||||
RgbColor red(128, 0, 0);
|
||||
RgbColor green(0, 128, 0);
|
||||
RgbColor blue(0, 0, 128);
|
||||
RgbColor white(128);
|
||||
// if using NeoRgbwFeature above, use this white instead to use
|
||||
// the correct white element of the LED
|
||||
//RgbwColor white(128);
|
||||
RgbColor black(0);
|
||||
|
||||
const uint16_t left = 0;
|
||||
const uint16_t right = PanelWidth - 1;
|
||||
const uint16_t top = 0;
|
||||
const uint16_t bottom = PanelHeight - 1;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); // wait for serial attach
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Initializing...");
|
||||
|
||||
strip.Begin();
|
||||
strip.Show();
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Running...");
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
delay(2500);
|
||||
|
||||
Serial.println();
|
||||
Serial.println("If your panel is correctly defined, you should see ...");
|
||||
Serial.println("Upper left is white.");
|
||||
Serial.println("Upper right is Red.");
|
||||
Serial.println("Lower right is Green");
|
||||
Serial.println("Lower Left is Blue");
|
||||
|
||||
// use the topo to map the 2d cordinate to the pixel
|
||||
// and use that to SetPixelColor
|
||||
strip.SetPixelColor(topo.Map(left, top), white);
|
||||
strip.SetPixelColor(topo.Map(right, top), red);
|
||||
strip.SetPixelColor(topo.Map(right, bottom), green);
|
||||
strip.SetPixelColor(topo.Map(left, bottom), blue);
|
||||
strip.Show();
|
||||
|
||||
delay(5000);
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Cleared to black ...");
|
||||
strip.ClearTo(black);
|
||||
strip.Show();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user