Added vertically aligned z map, more patterns, etc.

This commit is contained in:
Jason Coon 2017-10-21 09:19:07 -05:00
parent 9b6f17b81c
commit 623a03baa2
6 changed files with 405 additions and 54 deletions

89
Map.h
View File

@ -1,6 +1,34 @@
uint8_t coordsX[NUM_LEDS] = { 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 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6, 7 };
const uint8_t coordsVZ[NUM_LEDS] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 7, 6, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 11, 10, 9, 8, 7, 6, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 13, 12, 11, 10, 9, 8, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 15, 14, 13, 12, 11, 10, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 17, 16, 15, 14, 13, 12, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 21, 20, 19, 18, 17, 16, 15, 15, 16, 17, 18, 19, 20, 21, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 14, 15, 16, 17, 18, 19, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 12, 13, 14, 15, 16, 17, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 10, 11, 12, 13, 14, 15, 16, 15, 14, 13, 12, 11, 10, 9, 8, 22, 21, 20, 19, 18, 17, 16, 15, 14, 15, 16, 17, 18, 19, 20, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 13, 14, 15, 16, 17, 18, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 11, 12, 13, 14, 15, 16, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 9, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 7, 6, 5, 4, 3, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 10, 9, 8, 7, 6, 5, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 12, 11, 10, 9, 8, 7, 6, 7, 8, 9, 10, 11, 12, 13, 14 };
const uint8_t maxVZ = 22;
const uint8_t verticalHues = 255 / maxVZ;
void paletteFall() {
for (uint16_t i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) + (coordsVZ[i] * verticalHues));
}
}
void paletteRise() {
for (uint16_t i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - (coordsVZ[i] * verticalHues));
}
}
void gradientPaletteFall() {
for (uint16_t i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) + (coordsVZ[i] * verticalHues));
}
}
void gradientPaletteRise() {
for (uint16_t i = 0; i < NUM_LEDS; i++) {
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - (coordsVZ[i] * verticalHues));
}
}
void cubeXGradientPalette() {
uint8_t hues = 8;
@ -65,15 +93,66 @@ void cubeYZGradientPalette() {
}
}
void cubeXYZGradientPalette() {
void cubeXPalette() {
uint8_t hues = 8;
for (uint16_t i = 0; i < NUM_LEDS; i++) {
uint8_t x = coordsX[i];
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - (x * hues));
}
}
void cubeYPalette() {
uint8_t hues = 8;
for (uint16_t i = 0; i < NUM_LEDS; i++) {
uint8_t y = coordsY[i];
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - (y * hues));
}
}
void cubeZPalette() {
uint8_t hues = 8;
for (uint16_t i = 0; i < NUM_LEDS; i++) {
uint8_t z = coordsZ[i];
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - (z * hues));
}
}
void cubeXYPalette() {
uint8_t hues = 8;
for (uint16_t i = 0; i < NUM_LEDS; i++) {
uint8_t x = coordsX[i];
uint8_t y = coordsY[i];
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - ((x + y) * hues));
}
}
void cubeXZPalette() {
uint8_t hues = 8;
for (uint16_t i = 0; i < NUM_LEDS; i++) {
uint8_t x = coordsX[i];
uint8_t z = coordsZ[i];
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - ((x + y + z) * hues));
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - ((x + z) * hues));
}
}
void cubeYZPalette() {
uint8_t hues = 8;
for (uint16_t i = 0; i < NUM_LEDS; i++) {
uint8_t y = coordsY[i];
uint8_t z = coordsZ[i];
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - ((y + z) * hues));
}
}

18
Noise.h
View File

@ -110,18 +110,18 @@ void drawNoise3d(CRGBPalette16 palette, uint8_t hueReduce = 0)
}
void rainbowNoise3d() {
noisespeedx = 0;
noisespeedy = 0;
noisespeedz = -1;
noisespeedx = -1;
noisespeedy = -1;
noisespeedz = 0;
noisescale = 24;
colorLoop = 0;
drawNoise3d(RainbowColors_p);
}
void rainbowStripeNoise3d() {
noisespeedx = 0;
noisespeedy = 0;
noisespeedz = -2;
noisespeedx = -1;
noisespeedy = -1;
noisespeedz = -1;
noisescale = 24;
colorLoop = 0;
drawNoise3d(RainbowStripeColors_p);
@ -164,9 +164,9 @@ void fireNoise3d() {
}
void fireNoise23d() {
noisespeedx = 3;
noisespeedy = 3;
noisespeedz = 3;
noisespeedx = -3;
noisespeedy = -3;
noisespeedz = -3;
noisescale = 32;
colorLoop = 0;
drawNoise3d(HeatColors_p);

View File

@ -3,7 +3,7 @@ ULTiM8x8 Cube + FastLED + ESP8266 Web Server
Control an RGB LED cube with an ESP8266 via a web browser.
[![ULTiM8x8 Cube + FastLED + ESP8266 Web Server](https://i.imgur.com/SCHDFGx.gif)](https://i.imgur.com/SCHDFGx.gifv)
[![ULTiM8x8 Cube + FastLED + ESP8266 Web Server](SCHDFGx.gif)](https://i.imgur.com/SCHDFGx.gifv)
Hardware
--------

BIN
SCHDFGx.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 MiB

View File

@ -33,7 +33,6 @@ extern "C" {
#include <FS.h>
#include <EEPROM.h>
//#include <IRremoteESP8266.h>
#include "GradientPalettes.h"
#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
@ -114,6 +113,38 @@ unsigned long autoPlayTimeout = 0;
uint8_t currentPaletteIndex = 0;
typedef struct {
CRGBPalette16 palette;
String name;
} PaletteAndName;
typedef PaletteAndName PaletteAndNameList[];
const CRGBPalette16 palettes[] = {
RainbowColors_p,
RainbowStripeColors_p,
CloudColors_p,
LavaColors_p,
OceanColors_p,
ForestColors_p,
PartyColors_p,
HeatColors_p
};
const uint8_t paletteCount = ARRAY_SIZE(palettes);
const String paletteNames[paletteCount] = {
"Rainbow",
"Rainbow Stripe",
"Cloud",
"Lava",
"Ocean",
"Forest",
"Party",
"Heat",
};
#include "GradientPalettes.h"
uint8_t gHue = 0; // rotating "base color" used by many of the patterns
CRGB solidColor = CRGB::Blue;
@ -145,14 +176,34 @@ PatternAndNameList patterns = {
{ pride, "Pride" },
{ colorWaves, "Color Waves" },
{ cubeXGradientPalette, "X Gradient Palette" },
{ cubeYGradientPalette, "Y Gradient Palette" },
{ cubeZGradientPalette, "Z Gradient Palette" },
{ rainbowWavesFall, "Rainbow Waves Fall" },
{ rainbowWavesRise, "Rainbow Waves Rise" },
{ cubeXYGradientPalette, "XY Gradient Palette" },
{ cubeXZGradientPalette, "XZ Gradient Palette" },
{ cubeYZGradientPalette, "YZ Gradient Palette" },
{ cubeXYZGradientPalette, "XYZ Gradient Palette" },
{ paletteFall, "Palette Fall" },
{ paletteRise, "Palette Rise" },
{ gradientPaletteFall, "Gradient Palette Fall" },
{ gradientPaletteRise, "Gradient Palette Rise" },
{ rainbowWavesX, "Rainbow Waves X" },
{ rainbowWavesY, "Rainbow Waves Y" },
{ rainbowWavesZ, "Rainbow Waves Z" },
{ cubeXGradientPalette, "Gradient Palette X" },
{ cubeYGradientPalette, "Gradient Palette Y" },
{ cubeZGradientPalette, "Gradient Palette Z" },
{ cubeXYGradientPalette, "Gradient Palette XY" },
{ cubeXZGradientPalette, "Gradient Palette XZ" },
{ cubeYZGradientPalette, "Gradient Palette YZ" },
{ cubeXPalette, "Palette X" },
{ cubeYPalette, "Palette Y" },
{ cubeZPalette, "Palette Z" },
{ cubeXYPalette, "Palette XY" },
{ cubeXZPalette, "Palette XZ" },
{ cubeYZPalette, "Palette YZ" },
// 3d noise patterns
{ fireNoise3d, "Fire Noise" },
@ -206,36 +257,6 @@ PatternAndNameList patterns = {
const uint8_t patternCount = ARRAY_SIZE(patterns);
typedef struct {
CRGBPalette16 palette;
String name;
} PaletteAndName;
typedef PaletteAndName PaletteAndNameList[];
const CRGBPalette16 palettes[] = {
RainbowColors_p,
RainbowStripeColors_p,
CloudColors_p,
LavaColors_p,
OceanColors_p,
ForestColors_p,
PartyColors_p,
HeatColors_p
};
const uint8_t paletteCount = ARRAY_SIZE(palettes);
const String paletteNames[paletteCount] = {
"Rainbow",
"Rainbow Stripe",
"Cloud",
"Lava",
"Ocean",
"Forest",
"Party",
"Heat",
};
#include "Fields.h"
void setup() {
@ -1288,3 +1309,254 @@ void palettetest( CRGB* ledarray, uint16_t numleds, const CRGBPalette16& gCurren
startindex--;
fill_palette( ledarray, numleds, startindex, (256 / NUM_LEDS) + 1, gCurrentPalette, 255, LINEARBLEND);
}
void rainbowWavesX()
{
static uint16_t sPseudotime = 0;
static uint16_t sLastMillis = 0;
static uint16_t sHue16 = 0;
uint8_t sat8 = beatsin88( 87, 220, 250);
uint8_t brightdepth = beatsin88( 341, 96, 224);
uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
uint8_t msmultiplier = beatsin88(147, 23, 60);
uint16_t hue16 = sHue16;//gHue * 256;
uint16_t hueinc16 = beatsin88(113, 1, 3000);
uint16_t ms = millis();
uint16_t deltams = ms - sLastMillis ;
sLastMillis = ms;
sPseudotime += deltams * msmultiplier;
sHue16 += deltams * beatsin88( 400, 5, 9);
uint16_t brightnesstheta16 = sPseudotime;
for ( uint8_t i = 0 ; i < 8; i++) {
hue16 += hueinc16;
uint8_t hue8 = hue16 / 256;
brightnesstheta16 += brightnessthetainc16;
uint16_t b16 = sin16( brightnesstheta16 ) + 32768;
uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
bri8 += (255 - brightdepth);
CRGB newcolor = CHSV( hue8, sat8, bri8);
for(uint16_t p = 0; p < NUM_LEDS; p++) {
uint8_t x = coordsX[p];
if(x == i) {
nblend(leds[p], newcolor, 64);
}
}
}
}
void rainbowWavesY()
{
static uint16_t sPseudotime = 0;
static uint16_t sLastMillis = 0;
static uint16_t sHue16 = 0;
uint8_t sat8 = beatsin88( 87, 220, 250);
uint8_t brightdepth = beatsin88( 341, 96, 224);
uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
uint8_t msmultiplier = beatsin88(147, 23, 60);
uint16_t hue16 = sHue16;//gHue * 256;
uint16_t hueinc16 = beatsin88(113, 1, 3000);
uint16_t ms = millis();
uint16_t deltams = ms - sLastMillis ;
sLastMillis = ms;
sPseudotime += deltams * msmultiplier;
sHue16 += deltams * beatsin88( 400, 5, 9);
uint16_t brightnesstheta16 = sPseudotime;
for ( uint8_t i = 0 ; i < 8; i++) {
hue16 += hueinc16;
uint8_t hue8 = hue16 / 256;
brightnesstheta16 += brightnessthetainc16;
uint16_t b16 = sin16( brightnesstheta16 ) + 32768;
uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
bri8 += (255 - brightdepth);
CRGB newcolor = CHSV( hue8, sat8, bri8);
for(uint16_t p = 0; p < NUM_LEDS; p++) {
uint8_t y = coordsY[p];
if(y == i) {
nblend(leds[p], newcolor, 64);
}
}
}
}
void rainbowWavesZ()
{
static uint16_t sPseudotime = 0;
static uint16_t sLastMillis = 0;
static uint16_t sHue16 = 0;
uint8_t sat8 = beatsin88( 87, 220, 250);
uint8_t brightdepth = beatsin88( 341, 96, 224);
uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
uint8_t msmultiplier = beatsin88(147, 23, 60);
uint16_t hue16 = sHue16;//gHue * 256;
uint16_t hueinc16 = beatsin88(113, 1, 3000);
uint16_t ms = millis();
uint16_t deltams = ms - sLastMillis ;
sLastMillis = ms;
sPseudotime += deltams * msmultiplier;
sHue16 += deltams * beatsin88( 400, 5, 9);
uint16_t brightnesstheta16 = sPseudotime;
for ( uint8_t i = 0 ; i < 8; i++) {
hue16 += hueinc16;
uint8_t hue8 = hue16 / 256;
brightnesstheta16 += brightnessthetainc16;
uint16_t b16 = sin16( brightnesstheta16 ) + 32768;
uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
bri8 += (255 - brightdepth);
CRGB newcolor = CHSV( hue8, sat8, bri8);
for(uint16_t p = 0; p < NUM_LEDS; p++) {
uint8_t z = coordsZ[p];
if(z == i) {
nblend(leds[p], newcolor, 64);
}
}
}
}
void rainbowWavesFall()
{
static uint16_t sPseudotime = 0;
static uint16_t sLastMillis = 0;
static uint16_t sHue16 = 0;
uint8_t sat8 = beatsin88( 87, 220, 250);
uint8_t brightdepth = beatsin88( 341, 96, 224);
uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
uint8_t msmultiplier = beatsin88(147, 23, 60);
uint16_t hue16 = sHue16;//gHue * 256;
uint16_t hueinc16 = beatsin88(113, 1, 3000);
uint16_t ms = millis();
uint16_t deltams = ms - sLastMillis ;
sLastMillis = ms;
sPseudotime += deltams * msmultiplier;
sHue16 += deltams * beatsin88( 400, 5, 9);
uint16_t brightnesstheta16 = sPseudotime;
for ( uint8_t i = 0 ; i <= maxVZ; i++) {
hue16 += hueinc16;
uint8_t hue8 = hue16 / 256;
brightnesstheta16 += brightnessthetainc16;
uint16_t b16 = sin16( brightnesstheta16 ) + 32768;
uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
bri8 += (255 - brightdepth);
CRGB newcolor = CHSV( hue8, sat8, bri8);
for(uint16_t p = 0; p < NUM_LEDS; p++) {
if(i == coordsVZ[p]) {
nblend(leds[p], newcolor, 64);
}
}
}
}
void rainbowWavesRise()
{
static uint16_t sPseudotime = 0;
static uint16_t sLastMillis = 0;
static uint16_t sHue16 = 0;
uint8_t sat8 = beatsin88( 87, 220, 250);
uint8_t brightdepth = beatsin88( 341, 96, 224);
uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
uint8_t msmultiplier = beatsin88(147, 23, 60);
uint16_t hue16 = sHue16;//gHue * 256;
uint16_t hueinc16 = beatsin88(113, 1, 3000);
uint16_t ms = millis();
uint16_t deltams = ms - sLastMillis ;
sLastMillis = ms;
sPseudotime += deltams * msmultiplier;
sHue16 += deltams * beatsin88( 400, 5, 9);
uint16_t brightnesstheta16 = sPseudotime;
for ( uint8_t i = 0 ; i <= maxVZ; i++) {
hue16 += hueinc16;
uint8_t hue8 = hue16 / 256;
brightnesstheta16 += brightnessthetainc16;
uint16_t b16 = sin16( brightnesstheta16 ) + 32768;
uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
bri8 += (255 - brightdepth);
CRGB newcolor = CHSV( hue8, sat8, bri8);
for(uint16_t p = 0; p < NUM_LEDS; p++) {
if(i == maxVZ - coordsVZ[p]) {
nblend(leds[p], newcolor, 64);
}
}
}
}
void paletteRainXYZ() {
const uint8_t dropCount = 1;
const uint8_t maxDim = 7;
static uint8_t rainX[dropCount];
static uint8_t rainY[dropCount];
static uint8_t rainZ[dropCount];
dimAll(220);
for(uint8_t i = 0; i < dropCount; i++) {
uint8_t x = rainX[i];
uint8_t y = rainY[i];
uint8_t z = rainZ[i];
if(x == 0) x = maxDim;
if(y == 0) y = maxDim;
if(z == 0) z = random8(0, maxDim + 1);
for(uint16_t p = 0; p < NUM_LEDS; p++) {
if(coordsX[p] == x && coordsY[p] == y && coordsZ[p] == z) {
CRGB newcolor = ColorFromPalette(palettes[currentPaletteIndex], i);
nblend(leds[p], newcolor, 64);
}
}
EVERY_N_MILLIS(30) {
rainX[i] = x - 1;
rainY[i] = y;
rainZ[i] = z;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB