IP Configuration
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
// NeoPixelBuffer
|
||||
// This example will animate pixels using a bitmap stored on a SD card
|
||||
//
|
||||
//
|
||||
// This will demonstrate the use of the NeoBitmapFile object
|
||||
// NOTE: The images provided in the example directory should be copied to
|
||||
// the root of the SD card so the below code will find it.
|
||||
// NOTE: This sample and the included images were built for a 144 pixel strip so
|
||||
// running this with a smaller string may not look as interesting. Try providing
|
||||
// your own 24 bit bitmap for better results.
|
||||
|
||||
#include <NeoPixelBus.h>
|
||||
#include <NeoPixelAnimator.h>
|
||||
#include <SPI.h>
|
||||
#include <SD.h>
|
||||
|
||||
const int chipSelect = D8; // make sure to set this to your SD carder reader CS
|
||||
|
||||
//typedef NeoGrbFeature MyPixelColorFeature;
|
||||
typedef NeoGrbwFeature MyPixelColorFeature;
|
||||
|
||||
const uint16_t PixelCount = 144; // the sample images are meant for 144 pixels
|
||||
const uint16_t PixelPin = 2;
|
||||
const uint16_t AnimCount = 1; // we only need one
|
||||
|
||||
NeoPixelBus<MyPixelColorFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
// for esp8266 omit the pin
|
||||
//NeoPixelBus<MyPixelColorFeature, Neo800KbpsMethod> strip(PixelCount);
|
||||
NeoPixelAnimator animations(AnimCount); // NeoPixel animation management object
|
||||
|
||||
// our NeoBitmapFile will use the same color feature as NeoPixelBus and
|
||||
// we want it to use the SD File object
|
||||
NeoBitmapFile<MyPixelColorFeature, File> image;
|
||||
|
||||
uint16_t animState;
|
||||
|
||||
void LoopAnimUpdate(const AnimationParam& param)
|
||||
{
|
||||
// wait for this animation to complete,
|
||||
// we are using it as a timer of sorts
|
||||
if (param.state == AnimationState_Completed)
|
||||
{
|
||||
// done, time to restart this position tracking animation/timer
|
||||
animations.RestartAnimation(param.index);
|
||||
|
||||
// draw the complete row at animState to the complete strip
|
||||
image.Blt(strip, 0, 0, animState, image.Width());
|
||||
animState = (animState + 1) % image.Height(); // increment and wrap
|
||||
}
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
while (!Serial); // wait for serial attach
|
||||
|
||||
strip.Begin();
|
||||
strip.Show();
|
||||
|
||||
Serial.print("Initializing SD card...");
|
||||
|
||||
// see if the card is present and can be initialized:
|
||||
if (!SD.begin(chipSelect))
|
||||
{
|
||||
Serial.println("Card failed, or not present");
|
||||
// don't do anything more:
|
||||
return;
|
||||
}
|
||||
Serial.println("card initialized.");
|
||||
|
||||
// open the file
|
||||
File bitmapFile = SD.open("strings.bmp");
|
||||
if (!bitmapFile)
|
||||
{
|
||||
Serial.println("File open fail, or not present");
|
||||
// don't do anything more:
|
||||
return;
|
||||
}
|
||||
|
||||
// initialize the image with the file
|
||||
if (!image.Begin(bitmapFile))
|
||||
{
|
||||
Serial.println("File format fail, not a supported bitmap");
|
||||
// don't do anything more:
|
||||
return;
|
||||
}
|
||||
|
||||
animState = 0;
|
||||
// we use the index 0 animation to time how often we rotate all the pixels
|
||||
animations.StartAnimation(0, 30, LoopAnimUpdate);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
// this is all that is needed to keep it running
|
||||
// and avoiding using delay() is always a good thing for
|
||||
// any timing related routines
|
||||
animations.UpdateAnimations();
|
||||
strip.Show();
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 61 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
Binary file not shown.
@@ -0,0 +1,30 @@
|
||||
// To recreate the data below, use the Paint.Net plugin "Arduino Progmem NeoPixel FileType"
|
||||
// to save as/export the included Cylon.pdn
|
||||
// Paint.Net - http://www.getpaint.net/download.html#download
|
||||
// Plugin - http://forums.getpaint.net/index.php?/topic/107921-arduino-neopixel-sketch-exporter/
|
||||
// This uses Flatten, GRB, Hexadecimal
|
||||
//
|
||||
|
||||
const uint16_t myImageWidth = 16;
|
||||
const uint16_t myImageHeight = 20;
|
||||
const uint8_t PROGMEM myImage[] = { // (16 x 20) GRB in Hexadecimal
|
||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x3f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x3f, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
@@ -0,0 +1,30 @@
|
||||
// To recreate the data below, use the Paint.Net plugin "Arduino Progmem NeoPixel FileType"
|
||||
// to save as/export the included Cylon.pdn
|
||||
// Paint.Net - http://www.getpaint.net/download.html#download
|
||||
// Plugin - http://forums.getpaint.net/index.php?/topic/107921-arduino-neopixel-sketch-exporter/
|
||||
// This uses Flatten, GRBW, Hexadecimal
|
||||
//
|
||||
|
||||
const uint16_t myImageWidth = 16;
|
||||
const uint16_t myImageHeight = 20;
|
||||
const uint8_t PROGMEM myImage[] = { // (16 x 20) GRBW in Hexadecimal
|
||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x3f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
@@ -0,0 +1,74 @@
|
||||
// NeoPixelBufferCylon
|
||||
// This example will move a Cylon Red Eye back and forth across the
|
||||
// the full collection of pixels on the strip.
|
||||
//
|
||||
// This will demonstrate the use of the NeoVerticalSpriteSheet
|
||||
//
|
||||
|
||||
#include <NeoPixelBus.h>
|
||||
#include <NeoPixelAnimator.h>
|
||||
|
||||
// The actual image is contained in the data structure in one of the Cylon*.h files
|
||||
// You will need to use the one that has the same color feature as your NeoPixelBus
|
||||
// There are two provided, but you can create your own easily enough using
|
||||
// free versions of Paint.Net and the plugin
|
||||
#include "CylonGrb.h"
|
||||
typedef NeoGrbFeature MyPixelColorFeature;
|
||||
|
||||
// #include "CylonGrbw.h"
|
||||
// typedef NeoGrbwFeature MyPixelColorFeature;
|
||||
|
||||
const uint16_t PixelCount = 16; // the sample images are meant for 16 pixels
|
||||
const uint16_t PixelPin = 2;
|
||||
const uint16_t AnimCount = 1; // we only need one
|
||||
|
||||
NeoPixelBus<MyPixelColorFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
// for esp8266 omit the pin
|
||||
//NeoPixelBus<MyPixelColorFeature, Neo800KbpsMethod> strip(PixelCount);
|
||||
NeoPixelAnimator animations(AnimCount); // NeoPixel animation management object
|
||||
|
||||
// sprite sheet stored in progmem using the same pixel feature as the NeoPixelBus
|
||||
NeoVerticalSpriteSheet<NeoBufferProgmemMethod<MyPixelColorFeature>> spriteSheet(
|
||||
myImageWidth, // image width and sprite width since its vertical sprite sheet
|
||||
myImageHeight, // image height
|
||||
1, // sprite is only one pixel high
|
||||
myImage);
|
||||
|
||||
uint16_t indexSprite;
|
||||
|
||||
void LoopAnimUpdate(const AnimationParam& param)
|
||||
{
|
||||
// wait for this animation to complete,
|
||||
// we are using it as a timer of sorts
|
||||
if (param.state == AnimationState_Completed)
|
||||
{
|
||||
// done, time to restart this position tracking animation/timer
|
||||
animations.RestartAnimation(param.index);
|
||||
|
||||
// draw the next frame in the sprite
|
||||
spriteSheet.Blt(strip, 0, indexSprite);
|
||||
indexSprite = (indexSprite + 1) % myImageHeight; // increment and wrap
|
||||
}
|
||||
}
|
||||
|
||||
void setup()
|
||||
{
|
||||
strip.Begin();
|
||||
strip.Show();
|
||||
|
||||
indexSprite = 0;
|
||||
|
||||
// we use the index 0 animation to time how often we rotate all the pixels
|
||||
animations.StartAnimation(0, 60, LoopAnimUpdate);
|
||||
}
|
||||
|
||||
|
||||
void loop()
|
||||
{
|
||||
// this is all that is needed to keep it running
|
||||
// and avoiding using delay() is always a good thing for
|
||||
// any timing related routines
|
||||
animations.UpdateAnimations();
|
||||
strip.Show();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
// NeoPixelBufferShader
|
||||
// This example will provide a shader class to the NeoPixelBuffer that will dim and brighten
|
||||
// the pixels that are in the buffer (a device dependent bitmap)
|
||||
//
|
||||
|
||||
#include <NeoPixelBus.h>
|
||||
|
||||
const uint16_t PixelCount = 64; // set this to the size of your strip
|
||||
const uint8_t PixelPin = 2; // make sure to set this to the correct pin, ignored for Esp8266
|
||||
|
||||
// three element GRB pixels, change to your needs
|
||||
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
|
||||
// the buffer object,
|
||||
// defined to use memory with the same feature as the strip
|
||||
// initialized with the same number of pixels as our strip
|
||||
NeoBuffer<NeoBufferMethod<NeoGrbFeature>> image(8,8,NULL);
|
||||
|
||||
const RgbColor BrightRed(255, 0, 0);
|
||||
const RgbColor BrightGreen(0, 255, 0);
|
||||
const RgbColor BrightBlue(0, 0, 255);
|
||||
|
||||
const RgbColor BrightYellow(255, 255, 0);
|
||||
const RgbColor BrightCyan(0, 255, 255);
|
||||
const RgbColor BrightPurple(255, 0, 255);
|
||||
|
||||
const RgbColor DarkRed(32, 0, 0);
|
||||
const RgbColor DarkGreen(0, 32, 0);
|
||||
const RgbColor DarkBlue(0, 0, 32);
|
||||
|
||||
const RgbColor DarkYellow(32, 32, 0);
|
||||
const RgbColor DarkCyan(0, 32, 32);
|
||||
const RgbColor DarkPurple(32, 0, 32);
|
||||
|
||||
const RgbColor White(255);
|
||||
const RgbColor Black(0);
|
||||
|
||||
// define a custom shader object that provides brightness support
|
||||
// based upon the NeoShaderBase
|
||||
template<typename T_COLOR_FEATURE> class BrightnessShader : public NeoShaderBase
|
||||
{
|
||||
public:
|
||||
BrightnessShader():
|
||||
NeoShaderBase(),
|
||||
_brightness(255) // default to full bright
|
||||
{}
|
||||
|
||||
// required for a shader object, it will be called for
|
||||
// every pixel
|
||||
void Apply(uint16_t index, uint8_t* pDest, uint8_t* pSrc)
|
||||
{
|
||||
// we don't care what the index is so we ignore it
|
||||
//
|
||||
// to apply our brightness shader,
|
||||
// use the source color, modify, and apply to the destination
|
||||
|
||||
// for every byte in the pixel,
|
||||
// scale the source value by the brightness and
|
||||
// store it in the destination byte
|
||||
const uint8_t* pSrcEnd = pSrc + T_COLOR_FEATURE::PixelSize;
|
||||
while (pSrc != pSrcEnd)
|
||||
{
|
||||
*pDest++ = (*pSrc++ * (uint16_t(_brightness) + 1)) >> 8;
|
||||
}
|
||||
}
|
||||
|
||||
// provide an accessor to set brightness
|
||||
void setBrightness(uint8_t brightness)
|
||||
{
|
||||
_brightness = brightness;
|
||||
Dirty(); // must call dirty when a property changes
|
||||
}
|
||||
|
||||
// provide an accessor to get brightness
|
||||
uint8_t getBrightness()
|
||||
{
|
||||
return _brightness;
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t _brightness;
|
||||
};
|
||||
|
||||
// create an instance of our shader object with the same feature as our buffer
|
||||
BrightnessShader<NeoGrbFeature> shader;
|
||||
|
||||
// some dimming tracking variables and settings
|
||||
int8_t delta;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); // wait for serial attach
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Initializing...");
|
||||
Serial.flush();
|
||||
|
||||
// this resets all the neopixels to an off state
|
||||
strip.Begin();
|
||||
strip.Show();
|
||||
|
||||
// dibs do not default to any color,
|
||||
// so clear it to black if you aren't going to draw
|
||||
// into every pixel
|
||||
image.ClearTo(Black);
|
||||
|
||||
// draw a pattern into the image
|
||||
uint8_t x = 0;
|
||||
uint8_t y = 0;
|
||||
image.SetPixelColor(x++, y, DarkRed);
|
||||
image.SetPixelColor(x++, y, DarkYellow);
|
||||
image.SetPixelColor(x++, y, DarkGreen);
|
||||
image.SetPixelColor(x++, y, DarkCyan);
|
||||
image.SetPixelColor(x++, y, DarkBlue);
|
||||
image.SetPixelColor(x++, y, DarkPurple);
|
||||
|
||||
x = 0;
|
||||
y = 1;
|
||||
image.SetPixelColor(x++, y, BrightRed);
|
||||
image.SetPixelColor(x++, y, BrightYellow);
|
||||
image.SetPixelColor(x++, y, BrightGreen);
|
||||
image.SetPixelColor(x++, y, BrightCyan);
|
||||
image.SetPixelColor(x++, y, BrightBlue);
|
||||
image.SetPixelColor(x++, y, BrightPurple);
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Running...");
|
||||
|
||||
delta = -1; // start by dimming downward
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// we increment by delta every 30ms
|
||||
delay(30);
|
||||
|
||||
// update the brightness in shader
|
||||
//
|
||||
uint8_t brightness = shader.getBrightness();
|
||||
// check if we flip directions
|
||||
if (brightness == 0)
|
||||
{
|
||||
delta = 1; // increment
|
||||
}
|
||||
else if (brightness == 255)
|
||||
{
|
||||
delta = -1; // decrement
|
||||
}
|
||||
// modify and apply
|
||||
brightness += delta;
|
||||
shader.setBrightness(brightness);
|
||||
|
||||
Serial.println(brightness);
|
||||
|
||||
|
||||
// render the image using the shader and then call Show()
|
||||
// these two should be called together in order
|
||||
//
|
||||
|
||||
// need to provide the type of color feature for the strip and
|
||||
// the type of our custom shader
|
||||
image.Render<BrightnessShader<NeoGrbFeature>>(strip, shader);
|
||||
strip.Show();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
// NeoPixelDibTest
|
||||
// This example will provide a shader class to the NeoPixelDib that will dim and brighten
|
||||
// the pixels that are in the Dib (Device Independant Bitmap)
|
||||
//
|
||||
|
||||
#include <NeoPixelBus.h>
|
||||
|
||||
const uint16_t PixelCount = 64; // set this to the size of your strip
|
||||
const uint8_t PixelPin = 2; // make sure to set this to the correct pin, ignored for Esp8266
|
||||
|
||||
// three element GRB pixels, change to your needs
|
||||
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
|
||||
|
||||
// the DIB object, using RgbColor and initialized with the same number of pixels as our strip
|
||||
NeoDib<RgbColor> image(PixelCount);
|
||||
|
||||
const RgbColor BrightRed(255, 0, 0);
|
||||
const RgbColor BrightGreen(0, 255, 0);
|
||||
const RgbColor BrightBlue(0, 0, 255);
|
||||
|
||||
const RgbColor BrightYellow(255, 255, 0);
|
||||
const RgbColor BrightCyan(0, 255, 255);
|
||||
const RgbColor BrightPurple(255, 0, 255);
|
||||
|
||||
const RgbColor DarkRed(32, 0, 0);
|
||||
const RgbColor DarkGreen(0, 32, 0);
|
||||
const RgbColor DarkBlue(0, 0, 32);
|
||||
|
||||
const RgbColor DarkYellow(32, 32, 0);
|
||||
const RgbColor DarkCyan(0, 32, 32);
|
||||
const RgbColor DarkPurple(32, 0, 32);
|
||||
|
||||
const RgbColor White(255);
|
||||
const RgbColor Black(0);
|
||||
|
||||
// define a custom shader object that provides brightness support
|
||||
// based upon the NeoShaderBase
|
||||
class BrightnessShader : public NeoShaderBase
|
||||
{
|
||||
public:
|
||||
BrightnessShader():
|
||||
NeoShaderBase(),
|
||||
_brightness(255) // default to full bright
|
||||
{}
|
||||
|
||||
// required for a shader object, it will be called for
|
||||
// every pixel
|
||||
RgbColor Apply(uint16_t index, RgbColor original)
|
||||
{
|
||||
// we don't care what the index is so we ignore it
|
||||
//
|
||||
// to apply our brightness shader, modify the original color and return the color we want
|
||||
// blend from black (_brightness == 0.0) to the original color (_brightness == 1.0)
|
||||
|
||||
return RgbColor::LinearBlend(Black, original, (float)_brightness / 255.0f);
|
||||
}
|
||||
|
||||
// provide an accessor to set brightness
|
||||
void setBrightness(uint8_t brightness)
|
||||
{
|
||||
_brightness = brightness;
|
||||
Dirty(); // must call dirty when a property changes
|
||||
}
|
||||
|
||||
// provide an accessor to get brightness
|
||||
uint8_t getBrightness()
|
||||
{
|
||||
return _brightness;
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t _brightness;
|
||||
};
|
||||
|
||||
// create an instance of our shader object
|
||||
BrightnessShader shader;
|
||||
|
||||
// some dimming tracking variables and settings
|
||||
int8_t delta;
|
||||
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
while (!Serial); // wait for serial attach
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Initializing...");
|
||||
Serial.flush();
|
||||
|
||||
// this resets all the neopixels to an off state
|
||||
strip.Begin();
|
||||
strip.Show();
|
||||
|
||||
// dibs do not default to any color,
|
||||
// so clear it to black if you aren't going to draw
|
||||
// into every pixel
|
||||
image.ClearTo(Black);
|
||||
|
||||
// draw a pattern into the image
|
||||
uint8_t index = 0;
|
||||
image.SetPixelColor(index++, DarkRed);
|
||||
image.SetPixelColor(index++, DarkYellow);
|
||||
image.SetPixelColor(index++, DarkGreen);
|
||||
image.SetPixelColor(index++, DarkCyan);
|
||||
image.SetPixelColor(index++, DarkBlue);
|
||||
image.SetPixelColor(index++, DarkPurple);
|
||||
|
||||
image.SetPixelColor(index++, Black);
|
||||
image.SetPixelColor(index++, Black);
|
||||
|
||||
image.SetPixelColor(index++, BrightRed);
|
||||
image.SetPixelColor(index++, BrightYellow);
|
||||
image.SetPixelColor(index++, BrightGreen);
|
||||
image.SetPixelColor(index++, BrightCyan);
|
||||
image.SetPixelColor(index++, BrightBlue);
|
||||
image.SetPixelColor(index++, BrightPurple);
|
||||
|
||||
Serial.println();
|
||||
Serial.println("Running...");
|
||||
|
||||
delta = -1; // start by dimming downward
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
// we increment by delta every 30ms
|
||||
delay(30);
|
||||
|
||||
// update the brightness in shader
|
||||
//
|
||||
uint8_t brightness = shader.getBrightness();
|
||||
// check if we flip directions
|
||||
if (brightness == 0)
|
||||
{
|
||||
delta = 1; // increment
|
||||
}
|
||||
else if (brightness == 255)
|
||||
{
|
||||
delta = -1; // decrement
|
||||
}
|
||||
// modify and apply
|
||||
brightness += delta;
|
||||
shader.setBrightness(brightness);
|
||||
|
||||
Serial.println(brightness);
|
||||
|
||||
|
||||
// render the image using the shader and then call Show()
|
||||
// these two should be called together in order
|
||||
//
|
||||
|
||||
// need to provide the type of color feature for the strip and
|
||||
// the type of our custom shader
|
||||
image.Render<NeoGrbFeature, BrightnessShader>(strip, shader);
|
||||
strip.Show();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user