Compare commits
3 Commits
ultim8x8-c
...
wifi-exper
Author | SHA1 | Date | |
---|---|---|---|
a402019e4d | |||
1d4f7e74de | |||
545acb7144 |
165
Map.h
165
Map.h
@ -1,165 +0,0 @@
|
|||||||
// original 8x8x8 map (0-7), caused a seam between panels
|
|
||||||
// const 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, 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 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8, 8, 7, 6, 5, 4, 3, 2, 1, 1, 2, 3, 4, 5, 6, 7, 8 };
|
|
||||||
|
|
||||||
// vertically oriented z map
|
|
||||||
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;
|
|
||||||
|
|
||||||
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
|
||||||
uint8_t x = coordsX[i];
|
|
||||||
|
|
||||||
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - (x * hues));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cubeYGradientPalette() {
|
|
||||||
uint8_t hues = 8;
|
|
||||||
|
|
||||||
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
|
||||||
uint8_t y = coordsY[i];
|
|
||||||
|
|
||||||
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - (y * hues));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cubeZGradientPalette() {
|
|
||||||
uint8_t hues = 8;
|
|
||||||
|
|
||||||
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
|
||||||
uint8_t z = coordsZ[i];
|
|
||||||
|
|
||||||
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - (z * hues));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cubeXYGradientPalette() {
|
|
||||||
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(gCurrentPalette, beat8(speed) - ((x + y) * hues));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cubeXZGradientPalette() {
|
|
||||||
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 + z) * hues));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void cubeYZGradientPalette() {
|
|
||||||
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(gCurrentPalette, beat8(speed) - ((y + z) * hues));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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(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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
212
Noise.h
212
Noise.h
@ -1,212 +0,0 @@
|
|||||||
/*
|
|
||||||
ESP8266 + FastLED + IR Remote: https://github.com/jasoncoon/esp8266-fastled-webserver
|
|
||||||
Copyright (C) 2015-2016 Jason Coon
|
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
|
||||||
it under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
GNU General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// The 16 bit version of our coordinates
|
|
||||||
uint16_t noisex;
|
|
||||||
uint16_t noisey;
|
|
||||||
uint16_t noisez;
|
|
||||||
|
|
||||||
// We're using the x/y dimensions to map to the x/y pixels on the matrix. We'll
|
|
||||||
// use the z-axis for "time". speed determines how fast time moves forward. Try
|
|
||||||
// 1 for a very slow moving effect, or 60 for something that ends up looking like
|
|
||||||
// water.
|
|
||||||
int8_t noisespeedx = 0;
|
|
||||||
int8_t noisespeedy = 1;
|
|
||||||
int8_t noisespeedz = 0;
|
|
||||||
|
|
||||||
// Scale determines how far apart the pixels in our noise matrix are. Try
|
|
||||||
// changing these values around to see how it affects the motion of the display. The
|
|
||||||
// higher the value of scale, the more "zoomed out" the noise will be. A value
|
|
||||||
// of 1 will be so zoomed in, you'll mostly see solid colors.
|
|
||||||
uint16_t noisescale = 1; // scale is set dynamically once we've started up
|
|
||||||
|
|
||||||
uint8_t colorLoop = 0;
|
|
||||||
|
|
||||||
CRGBPalette16 blackAndWhiteStripedPalette;
|
|
||||||
|
|
||||||
// This function sets up a palette of black and white stripes,
|
|
||||||
// using code. Since the palette is effectively an array of
|
|
||||||
// sixteen CRGB colors, the various fill_* functions can be used
|
|
||||||
// to set them up.
|
|
||||||
void SetupBlackAndWhiteStripedPalette()
|
|
||||||
{
|
|
||||||
// 'black out' all 16 palette entries...
|
|
||||||
fill_solid( blackAndWhiteStripedPalette, 16, CRGB::Black);
|
|
||||||
// and set every fourth one to white.
|
|
||||||
blackAndWhiteStripedPalette[0] = CRGB::White;
|
|
||||||
blackAndWhiteStripedPalette[4] = CRGB::White;
|
|
||||||
blackAndWhiteStripedPalette[8] = CRGB::White;
|
|
||||||
blackAndWhiteStripedPalette[12] = CRGB::White;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CRGBPalette16 blackAndBlueStripedPalette;
|
|
||||||
|
|
||||||
// This function sets up a palette of black and blue stripes,
|
|
||||||
// using code. Since the palette is effectively an array of
|
|
||||||
// sixteen CRGB colors, the various fill_* functions can be used
|
|
||||||
// to set them up.
|
|
||||||
void SetupBlackAndBlueStripedPalette()
|
|
||||||
{
|
|
||||||
// 'black out' all 16 palette entries...
|
|
||||||
fill_solid( blackAndBlueStripedPalette, 16, CRGB::Black);
|
|
||||||
|
|
||||||
for(uint8_t i = 0; i < 6; i++) {
|
|
||||||
blackAndBlueStripedPalette[i] = CRGB::Blue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// There are several different palettes of colors demonstrated here.
|
|
||||||
//
|
|
||||||
// FastLED provides several 'preset' palettes: RainbowColors_p, RainbowStripeColors_p,
|
|
||||||
// OceanColors_p, CloudColors_p, LavaColors_p, ForestColors_p, and PartyColors_p.
|
|
||||||
//
|
|
||||||
// Additionally, you can manually define your own color palettes, or you can write
|
|
||||||
// code that creates color palettes on the fly.
|
|
||||||
|
|
||||||
void drawNoise3d(CRGBPalette16 palette, uint8_t hueReduce = 0)
|
|
||||||
{
|
|
||||||
for(uint16_t i = 0; i < NUM_LEDS; i++) {
|
|
||||||
uint8_t x = coordsX[i];
|
|
||||||
uint8_t y = coordsY[i];
|
|
||||||
uint8_t z = coordsZ[i];
|
|
||||||
|
|
||||||
int xoffset = noisescale * x;
|
|
||||||
int yoffset = noisescale * y;
|
|
||||||
int zoffset = noisescale * z;
|
|
||||||
|
|
||||||
uint8_t data = inoise8(x + xoffset + noisex, y + yoffset + noisey, z + zoffset + noisez);
|
|
||||||
|
|
||||||
// The range of the inoise8 function is roughly 16-238.
|
|
||||||
// These two operations expand those values out to roughly 0..255
|
|
||||||
// You can comment them out if you want the raw noise data.
|
|
||||||
data = qsub8(data, 16);
|
|
||||||
data = qadd8(data, scale8(data, 39));
|
|
||||||
|
|
||||||
if(hueReduce > 0 && data >= hueReduce)
|
|
||||||
data -= hueReduce;
|
|
||||||
|
|
||||||
leds[i] = ColorFromPalette(palette, data, 255, LINEARBLEND);
|
|
||||||
}
|
|
||||||
|
|
||||||
noisex += noisespeedx;
|
|
||||||
noisey += noisespeedy;
|
|
||||||
noisez += noisespeedz;
|
|
||||||
}
|
|
||||||
|
|
||||||
void rainbowNoise3d() {
|
|
||||||
noisespeedx = -1;
|
|
||||||
noisespeedy = -1;
|
|
||||||
noisespeedz = 0;
|
|
||||||
noisescale = 24;
|
|
||||||
colorLoop = 0;
|
|
||||||
drawNoise3d(RainbowColors_p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void rainbowStripeNoise3d() {
|
|
||||||
noisespeedx = -1;
|
|
||||||
noisespeedy = -1;
|
|
||||||
noisespeedz = -1;
|
|
||||||
noisescale = 24;
|
|
||||||
colorLoop = 0;
|
|
||||||
drawNoise3d(RainbowStripeColors_p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void partyNoise3d() {
|
|
||||||
noisespeedx = -9;
|
|
||||||
noisespeedy = 0;
|
|
||||||
noisespeedz = 0;
|
|
||||||
noisescale = 32;
|
|
||||||
colorLoop = 0;
|
|
||||||
drawNoise3d(PartyColors_p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void forestNoise3d() {
|
|
||||||
noisespeedx = -9;
|
|
||||||
noisespeedy = 0;
|
|
||||||
noisespeedz = 0;
|
|
||||||
noisescale = 32;
|
|
||||||
colorLoop = 0;
|
|
||||||
drawNoise3d(ForestColors_p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cloudNoise3d() {
|
|
||||||
noisespeedx = -2;
|
|
||||||
noisespeedy = 0;
|
|
||||||
noisespeedz = 0;
|
|
||||||
noisescale = 24;
|
|
||||||
colorLoop = 0;
|
|
||||||
drawNoise3d(CloudColors_p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void fireNoise3d() {
|
|
||||||
noisespeedx = 16;
|
|
||||||
noisespeedy = 16;
|
|
||||||
noisespeedz = 16;
|
|
||||||
noisescale = 64;
|
|
||||||
colorLoop = 0;
|
|
||||||
drawNoise3d(HeatColors_p, 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
void fireNoise23d() {
|
|
||||||
noisespeedx = -3;
|
|
||||||
noisespeedy = -3;
|
|
||||||
noisespeedz = -3;
|
|
||||||
noisescale = 32;
|
|
||||||
colorLoop = 0;
|
|
||||||
drawNoise3d(HeatColors_p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void lavaNoise3d() {
|
|
||||||
noisespeedx = -4;
|
|
||||||
noisespeedy = -4;
|
|
||||||
noisespeedz = -4;
|
|
||||||
noisescale = 32;
|
|
||||||
colorLoop = 0;
|
|
||||||
drawNoise3d(LavaColors_p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void oceanNoise3d() {
|
|
||||||
noisespeedx = -2;
|
|
||||||
noisespeedy = 0;
|
|
||||||
noisespeedz = 4;
|
|
||||||
noisescale = 24;
|
|
||||||
colorLoop = 0;
|
|
||||||
drawNoise3d(OceanColors_p);
|
|
||||||
}
|
|
||||||
|
|
||||||
void blackAndWhiteNoise3d() {
|
|
||||||
SetupBlackAndWhiteStripedPalette();
|
|
||||||
noisespeedx = -12;
|
|
||||||
noisespeedy = 0;
|
|
||||||
noisespeedz = 0;
|
|
||||||
noisescale = 24;
|
|
||||||
colorLoop = 0;
|
|
||||||
drawNoise3d(blackAndWhiteStripedPalette);
|
|
||||||
}
|
|
||||||
|
|
||||||
void blackAndBlueNoise3d() {
|
|
||||||
SetupBlackAndBlueStripedPalette();
|
|
||||||
noisespeedx = -4;
|
|
||||||
noisespeedy = -4;
|
|
||||||
noisespeedz = -4;
|
|
||||||
noisescale = 32;
|
|
||||||
colorLoop = 0;
|
|
||||||
drawNoise3d(blackAndBlueStripedPalette);
|
|
||||||
}
|
|
||||||
|
|
29
README.md
29
README.md
@ -1,30 +1,28 @@
|
|||||||
ULTiM8x8 Cube + FastLED + ESP8266 Web Server
|
FastLED + ESP8266 Web Server
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Control an RGB LED cube with an ESP8266 via a web browser.
|
Control an addressable LED strip with an ESP8266 via a web browser or infrared remote control.
|
||||||
|
|
||||||
[](https://i.imgur.com/SCHDFGx.gifv)
|
|
||||||
|
|
||||||
Hardware
|
Hardware
|
||||||
--------
|
--------
|
||||||
|
|
||||||
##### ESP8266 development board
|
##### ESP8266 development board
|
||||||
|
|
||||||
[](https://www.adafruit.com/product/2821)
|
|
||||||
|
|
||||||
[Adafruit Feather HUZZAH with ESP8266 WiFi](https://www.adafruit.com/product/2821)
|
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
[](https://www.aliexpress.com/item/WEMOS-D1-mini-Pro-16M-bytes-external-antenna-connector-ESP8266-WIFI-Internet-of-Things-development-board/32724692514.html)
|
[](https://www.aliexpress.com/item/WEMOS-D1-mini-Pro-16M-bytes-external-antenna-connector-ESP8266-WIFI-Internet-of-Things-development-board/32724692514.html)
|
||||||
|
|
||||||
[Wemos D1 Mini Pro & Headers](https://www.aliexpress.com/item/WEMOS-D1-mini-Pro-16M-bytes-external-antenna-connector-ESP8266-WIFI-Internet-of-Things-development-board/32724692514.html)
|
[Wemos D1 Mini Pro & Headers](https://www.aliexpress.com/item/WEMOS-D1-mini-Pro-16M-bytes-external-antenna-connector-ESP8266-WIFI-Internet-of-Things-development-board/32724692514.html)
|
||||||
|
|
||||||
##### 6 x ULTiM8x8 RGB LED panels
|
or
|
||||||
|
|
||||||
[](http://wyolum.com/ultim8x8/)
|
[](https://www.adafruit.com/products/2471)
|
||||||
|
|
||||||
[ULTiM8x8 RGB LED panels](http://wyolum.com/ultim8x8/)
|
[Adafruit HUZZAH ESP8266 Breakout](https://www.adafruit.com/products/2471)
|
||||||
|
|
||||||
|
##### Addressable LED strip
|
||||||
|
|
||||||
|
[](https://www.adafruit.com/product/1586)
|
||||||
|
|
||||||
|
[Adafruit NeoPixel Ring]
|
||||||
|
|
||||||
Other hardware:
|
Other hardware:
|
||||||
|
|
||||||
@ -42,7 +40,7 @@ Optional shield to make everything more tidy:
|
|||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
* Turn the LEDs on and off
|
* Turn the NeoPixel Ring on and off
|
||||||
* Adjust the brightness
|
* Adjust the brightness
|
||||||
* Change the display pattern
|
* Change the display pattern
|
||||||
* Adjust the color
|
* Adjust the color
|
||||||
@ -98,3 +96,6 @@ Infrared Remote Control
|
|||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Control via infrared remote control is also supported, via the [ESP8266 port of the IRremote library](https://github.com/sebastienwarin/IRremoteESP8266).
|
Control via infrared remote control is also supported, via the [ESP8266 port of the IRremote library](https://github.com/sebastienwarin/IRremoteESP8266).
|
||||||
|
|
||||||
|
[Adafruit NeoPixel Ring]:https://www.adafruit.com/product/1586
|
||||||
|
[Adafruit HUZZAH ESP8266 Breakout]:https://www.adafruit.com/products/2471
|
||||||
|
BIN
SCHDFGx.gif
BIN
SCHDFGx.gif
Binary file not shown.
Before Width: | Height: | Size: 27 MiB |
@ -194,7 +194,7 @@ void drawTwinkles()
|
|||||||
|
|
||||||
uint8_t backgroundBrightness = bg.getAverageLight();
|
uint8_t backgroundBrightness = bg.getAverageLight();
|
||||||
|
|
||||||
for(uint16_t i = 0; i < NUM_LEDS; i++) {
|
for(uint8_t i = 0; i < NUM_LEDS; i++) {
|
||||||
CRGB& pixel = leds[i];
|
CRGB& pixel = leds[i];
|
||||||
|
|
||||||
PRNG16 = (uint16_t)(PRNG16 * 2053) + 1384; // next 'random' number
|
PRNG16 = (uint16_t)(PRNG16 * 2053) + 1384; // next 'random' number
|
||||||
|
157
WiFi.h
Normal file
157
WiFi.h
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
//#include <DNSServer.h>
|
||||||
|
|
||||||
|
//DNSServer dnsServer;
|
||||||
|
|
||||||
|
//const byte DNS_PORT = 53;
|
||||||
|
|
||||||
|
// AP mode password
|
||||||
|
const char WiFiAPPSK[] = "";
|
||||||
|
|
||||||
|
// Wi-Fi network to connect to (leave blank to connect to saved network, or to start in AP mode)
|
||||||
|
const char* ssid = "";
|
||||||
|
const char* password = "";
|
||||||
|
|
||||||
|
#define HOSTNAME "ESP8266-" ///< Hostname. The initializeWiFi function adds the Chip ID at the end.
|
||||||
|
|
||||||
|
#define DEBUG_WIFI 1
|
||||||
|
|
||||||
|
WiFiMode mode = WIFI_STA; // connect to existing Wi-Fi network
|
||||||
|
//WiFiMode mode = WIFI_AP; // act as an Access Point, creating a new Wi-Fi network
|
||||||
|
//WiFiMode mode = WIFI_AP_STA; // act as both a client and Access Point (mesh mode)
|
||||||
|
|
||||||
|
template <typename Generic>
|
||||||
|
void debugPrint(Generic text) {
|
||||||
|
if (DEBUG_WIFI) {
|
||||||
|
Serial.print(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename Generic>
|
||||||
|
void debugPrintln(Generic text) {
|
||||||
|
if (DEBUG_WIFI) {
|
||||||
|
Serial.println(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String getWiFiJson() {
|
||||||
|
String hostname = String(HOSTNAME);
|
||||||
|
hostname += String(ESP.getChipId(), HEX);
|
||||||
|
|
||||||
|
String json = "{";
|
||||||
|
|
||||||
|
json += "\"status\":\"" + String(WiFi.status()) + "\"";
|
||||||
|
json += ",\"localIP\":\"" + WiFi.localIP().toString() + "\"";
|
||||||
|
json += ",\"softAPIP\":\"" + WiFi.softAPIP().toString() + "\"";
|
||||||
|
json += ",\"hostname\":\"" + hostname + "\"";
|
||||||
|
json += ",\"ssid\":\"" + WiFi.SSID() + "\"";
|
||||||
|
json += ",\"rssi\":\"" + String(WiFi.RSSI()) + "\"";
|
||||||
|
|
||||||
|
json += ",\"networks\":[";
|
||||||
|
byte ssidCount = WiFi.scanNetworks();
|
||||||
|
for (byte i = 0; i < ssidCount; i++) {
|
||||||
|
if (i > 0)
|
||||||
|
json += ",";
|
||||||
|
|
||||||
|
json += "{\"name\":\"" + WiFi.SSID(i) + "\",\"rssi\":\"" + String(WiFi.RSSI(i)) + "\"}";
|
||||||
|
}
|
||||||
|
|
||||||
|
json += "]";
|
||||||
|
|
||||||
|
json += "}";
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
void initializeWiFi() {
|
||||||
|
// Set Hostname.
|
||||||
|
String hostname = String(HOSTNAME);
|
||||||
|
hostname += String(ESP.getChipId(), HEX);
|
||||||
|
WiFi.hostname(hostname);
|
||||||
|
|
||||||
|
// Print hostname.
|
||||||
|
Serial.println("Hostname: " + hostname);
|
||||||
|
|
||||||
|
char hostnameChar[hostname.length() + 1];
|
||||||
|
memset(hostnameChar, 0, hostname.length() + 1);
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < hostname.length(); i++)
|
||||||
|
hostnameChar[i] = hostname.charAt(i);
|
||||||
|
|
||||||
|
// MDNS.begin(hostnameChar);
|
||||||
|
|
||||||
|
// Add service to MDNS-SD
|
||||||
|
// MDNS.addService("http", "tcp", 80);
|
||||||
|
|
||||||
|
// attempt to connect; should it fail, fall back to AP mode
|
||||||
|
// WiFi.mode(WIFI_STA);
|
||||||
|
|
||||||
|
String stored_ssid = WiFi.SSID();
|
||||||
|
|
||||||
|
if (ssid != NULL && password != NULL &&
|
||||||
|
ssid != "" && password != "") {
|
||||||
|
debugPrint("WiFi mode: ");
|
||||||
|
debugPrintln(WIFI_STA);
|
||||||
|
WiFi.mode(WIFI_STA);
|
||||||
|
|
||||||
|
debugPrint("Connecting to hard-coded SSID: ");
|
||||||
|
debugPrintln(stored_ssid);
|
||||||
|
WiFi.begin(ssid, password);
|
||||||
|
}
|
||||||
|
else if (stored_ssid != NULL && stored_ssid != "") {
|
||||||
|
debugPrint("WiFi mode: ");
|
||||||
|
debugPrintln(WIFI_STA);
|
||||||
|
WiFi.mode(WIFI_STA);
|
||||||
|
|
||||||
|
debugPrint("Connecting to stored SSID: ");
|
||||||
|
debugPrintln(stored_ssid);
|
||||||
|
WiFi.begin();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
debugPrintln("No stored SSID");
|
||||||
|
debugPrint("Starting soft AP: ");
|
||||||
|
debugPrintln(hostnameChar);
|
||||||
|
|
||||||
|
WiFi.mode(WIFI_AP);
|
||||||
|
|
||||||
|
if (WiFiAPPSK != NULL) {
|
||||||
|
debugPrint(WiFi.softAP(hostnameChar, WiFiAPPSK) ? "ready" : "failed");
|
||||||
|
} else {
|
||||||
|
debugPrint(WiFi.softAP(hostnameChar) ? "ready" : "failed");
|
||||||
|
}
|
||||||
|
|
||||||
|
debugPrint("Connect to Wi-Fi access point: ");
|
||||||
|
debugPrintln(hostnameChar);
|
||||||
|
|
||||||
|
delay(500); // Without delay I've seen the IP address blank
|
||||||
|
debugPrint("AP IP address: ");
|
||||||
|
debugPrintln(WiFi.softAPIP());
|
||||||
|
|
||||||
|
// dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
|
||||||
|
// dnsServer.start(DNS_PORT, "*", WiFi.softAPIP());
|
||||||
|
}
|
||||||
|
|
||||||
|
webServer.on("/wifi", HTTP_POST, []() {
|
||||||
|
String ssid = webServer.arg("ssid");
|
||||||
|
String password = webServer.arg("password");
|
||||||
|
|
||||||
|
char ssidChars[50];
|
||||||
|
ssid.toCharArray(ssidChars, 50);
|
||||||
|
|
||||||
|
char passwordChars[50];
|
||||||
|
password.toCharArray(passwordChars, 50);
|
||||||
|
|
||||||
|
debugPrint("Connecting to new SSID: ");
|
||||||
|
debugPrintln(ssid);
|
||||||
|
|
||||||
|
WiFi.begin(ssidChars, passwordChars);
|
||||||
|
|
||||||
|
webServer.sendHeader("Location", "/wifi.htm");
|
||||||
|
webServer.send(303);
|
||||||
|
});
|
||||||
|
|
||||||
|
webServer.on("/wifi", HTTP_GET, []() {
|
||||||
|
String json = getWiFiJson();
|
||||||
|
webServer.send(200, "application/json", json);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
@ -2,20 +2,10 @@
|
|||||||
padding-bottom: 70px;
|
padding-bottom: 70px;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
.grid-item-color-button {
|
|
||||||
border: 0px;
|
|
||||||
width: 7.69%;
|
|
||||||
height: 64px;
|
|
||||||
margin: 0px;
|
|
||||||
padding: 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.grid-item-color {
|
.grid-item-color {
|
||||||
border: none;
|
width: 4%;
|
||||||
width: 3.33%;
|
|
||||||
height: 32px;
|
height: 32px;
|
||||||
margin: 0px;
|
cursor: pointer;
|
||||||
padding: 0px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.grid-item-pattern {
|
.grid-item-pattern {
|
||||||
|
BIN
data/images/github.ico
Normal file
BIN
data/images/github.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
@ -5,7 +5,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Cube by Evil Genius Labs</title>
|
<title>ESP8266 + FastLED by Evil Genius Labs</title>
|
||||||
|
|
||||||
<!-- request CSS from internet CDN -->
|
<!-- request CSS from internet CDN -->
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<!-- request CSS from the ESP8266 web server -->
|
<!-- request CSS from the ESP8266 web server -->
|
||||||
<!-- <link rel="stylesheet" href="css/bootstrap.min.css"> -->
|
<!-- <link rel="stylesheet" href="css/bootstrap.min.css"> -->
|
||||||
<!-- <link rel="stylesheet" href="css/jquery.minicolors.min.css"> -->
|
<!-- <link rel="stylesheet" href="css/minicolors.min.css"> -->
|
||||||
|
|
||||||
<link rel="stylesheet" href="css/styles.css">
|
<link rel="stylesheet" href="css/styles.css">
|
||||||
|
|
||||||
@ -31,20 +31,21 @@
|
|||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
</button>
|
</button>
|
||||||
<a class="navbar-brand" href="https://www.evilgeniuslabs.org" target="_blank"><img src="https://evilgeniuslabs.org/images/atom.svg" style="width: 24px; height: 24px;" /></a>
|
<a class="navbar-brand" href="https://www.evilgeniuslabs.org" target="_blank"><img src="/images/atom196.png" style="width: 24px; height: 24px;" /></a>
|
||||||
<a class="navbar-brand" href="https://www.evilgeniuslabs.org" target="_blank">Evil Genius Labs</a>
|
<a class="navbar-brand" href="https://www.evilgeniuslabs.org" target="_blank">Evil Genius Labs</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="collapse navbar-collapse" id="navbar-collapse-1">
|
<div class="collapse navbar-collapse" id="navbar-collapse-1">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li class="active"><a href="/">Cube <span class="sr-only">(current)</span></a></li>
|
<li class="active"><a href="/">ESP8266 + FastLED <span class="sr-only">(current)</span></a></li>
|
||||||
<li><a href="/simple.htm" target="_blank" title="Simple Mode">Simple</a></li>
|
<li><a href="/simple.htm" target="_blank" title="Simple Mode">Simple</a></li>
|
||||||
<li><a href="/edit.htm" target="_blank" title="Edit Files">Files</a></li>
|
<li><a href="/edit.htm" target="_blank" title="Edit Files">Files</a></li>
|
||||||
<li><a href="/update" target="_blank" title="Update Firmware">Firmware</a></li>
|
<li><a href="/update" target="_blank" title="Update Firmware">Firmware</a></li>
|
||||||
|
<li><a href="/wifi.htm" target="_blank" title="Wi-Fi Settings">Wi-Fi</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="nav navbar-nav navbar-right">
|
<ul class="nav navbar-nav navbar-right">
|
||||||
<li>
|
<li>
|
||||||
<a href="https://github.com/jasoncoon/esp8266-fastled-webserver">
|
<a href="https://github.com/jasoncoon/esp8266-fastled-webserver">
|
||||||
<img style="height: 16px;" src="https://assets-cdn.github.com/favicon.ico" />
|
<img style="height: 16px;" src="/images/github.ico" />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -215,7 +216,7 @@
|
|||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<!-- request js from internet CDN -->
|
<!-- request js from internet CDN -->
|
||||||
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script> -->
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-minicolors/2.2.4/jquery.minicolors.min.js" integrity="sha256-XAFQ9dZ6hy8p/GRhU8h/8pMvM1etymiJLZW1CiHV3bQ=" crossorigin="anonymous"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-minicolors/2.2.4/jquery.minicolors.min.js" integrity="sha256-XAFQ9dZ6hy8p/GRhU8h/8pMvM1etymiJLZW1CiHV3bQ=" crossorigin="anonymous"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/reconnecting-websocket/1.0.0/reconnecting-websocket.min.js" integrity="sha256-A4JwlcDvqO4JXpvEtvWY1RH8JAEMu5W21wP8GUXLUNs=" crossorigin="anonymous"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/reconnecting-websocket/1.0.0/reconnecting-websocket.min.js" integrity="sha256-A4JwlcDvqO4JXpvEtvWY1RH8JAEMu5W21wP8GUXLUNs=" crossorigin="anonymous"></script>
|
||||||
@ -223,7 +224,7 @@
|
|||||||
<!-- request js from the ESP8266 web server -->
|
<!-- request js from the ESP8266 web server -->
|
||||||
<!-- <script src="js/jquery-3.1.1.min.js"></script> -->
|
<!-- <script src="js/jquery-3.1.1.min.js"></script> -->
|
||||||
<!-- <script src="js/bootstrap.min.js"></script> -->
|
<!-- <script src="js/bootstrap.min.js"></script> -->
|
||||||
<!-- <script src="js/jquery.minicolors.min.js"></script> -->
|
<!-- <script src="js/minicolors.min.js"></script> -->
|
||||||
<!-- <script src="js/r-websocket.min.js"></script> -->
|
<!-- <script src="js/r-websocket.min.js"></script> -->
|
||||||
|
|
||||||
<script src="js/app.js"></script>
|
<script src="js/app.js"></script>
|
||||||
|
@ -1,9 +1,14 @@
|
|||||||
|
// require ./jquery-3.1.1.min.js
|
||||||
|
// require ./bootstrap.min.js
|
||||||
|
// require ./minicolors.min.js
|
||||||
|
// require ./r-websocket.min.js
|
||||||
|
|
||||||
// used when hosting the site on the ESP8266
|
// used when hosting the site on the ESP8266
|
||||||
var address = location.hostname;
|
var address = location.hostname;
|
||||||
var urlBase = "";
|
var urlBase = "";
|
||||||
|
|
||||||
// used when hosting the site somewhere other than the ESP8266 (handy for testing without waiting forever to upload to SPIFFS)
|
// used when hosting the site somewhere other than the ESP8266 (handy for testing without waiting forever to upload to SPIFFS)
|
||||||
// var address = "192.168.86.55";
|
// var address = "esp8266-1920f7.local";
|
||||||
// var urlBase = "http://" + address + "/";
|
// var urlBase = "http://" + address + "/";
|
||||||
|
|
||||||
var postColorTimer = {};
|
var postColorTimer = {};
|
||||||
|
2
data/js/bootstrap.min.js
vendored
2
data/js/bootstrap.min.js
vendored
@ -1,3 +1,5 @@
|
|||||||
|
// require ./jquery-3.1.1.min.js
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Bootstrap v3.3.7 (http://getbootstrap.com)
|
* Bootstrap v3.3.7 (http://getbootstrap.com)
|
||||||
* Copyright 2011-2016 Twitter, Inc.
|
* Copyright 2011-2016 Twitter, Inc.
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
// require ./jquery-3.1.1.min.js
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* jQuery MiniColors: A tiny color picker built on jQuery
|
* jQuery MiniColors: A tiny color picker built on jQuery
|
||||||
*
|
*
|
@ -3,7 +3,7 @@ var address = location.hostname;
|
|||||||
var urlBase = "";
|
var urlBase = "";
|
||||||
|
|
||||||
// used when hosting the site somewhere other than the ESP8266 (handy for testing without waiting forever to upload to SPIFFS)
|
// used when hosting the site somewhere other than the ESP8266 (handy for testing without waiting forever to upload to SPIFFS)
|
||||||
// var address = "192.168.86.55";
|
// var address = "192.168.1.13";
|
||||||
// var urlBase = "http://" + address + "/";
|
// var urlBase = "http://" + address + "/";
|
||||||
|
|
||||||
var postColorTimer = {};
|
var postColorTimer = {};
|
||||||
@ -15,27 +15,6 @@ var patterns = [
|
|||||||
"Pride",
|
"Pride",
|
||||||
"Color Waves",
|
"Color Waves",
|
||||||
|
|
||||||
"X Gradient Palette",
|
|
||||||
"Y Gradient Palette",
|
|
||||||
"Z Gradient Palette",
|
|
||||||
|
|
||||||
"XY Gradient Palette",
|
|
||||||
"XZ Gradient Palette",
|
|
||||||
"YZ Gradient Palette",
|
|
||||||
"XYZ Gradient Palette",
|
|
||||||
|
|
||||||
"Fire Noise",
|
|
||||||
"Fire Noise 2",
|
|
||||||
"Lava Noise",
|
|
||||||
"Rainbow Noise",
|
|
||||||
"Rainbow Stripe Noise",
|
|
||||||
"Party Noise",
|
|
||||||
"Forest Noise",
|
|
||||||
"Cloud Noise",
|
|
||||||
"Ocean Noise",
|
|
||||||
"Black & White Noise",
|
|
||||||
"Black & Blue Noise",
|
|
||||||
|
|
||||||
"Rainbow Twinkles",
|
"Rainbow Twinkles",
|
||||||
"Snow Twinkles",
|
"Snow Twinkles",
|
||||||
"Cloud Twinkles",
|
"Cloud Twinkles",
|
||||||
@ -56,11 +35,15 @@ var patterns = [
|
|||||||
"Cloud 2 Twinkles",
|
"Cloud 2 Twinkles",
|
||||||
"Ocean Twinkles",
|
"Ocean Twinkles",
|
||||||
|
|
||||||
|
"Rainbow",
|
||||||
|
"Rainbow With Glitter",
|
||||||
"Solid Rainbow",
|
"Solid Rainbow",
|
||||||
"Confetti",
|
"Confetti",
|
||||||
"Sinelon",
|
"Sinelon",
|
||||||
"Beat",
|
"Beat",
|
||||||
"Juggle",
|
"Juggle",
|
||||||
|
"Fire",
|
||||||
|
"Water"
|
||||||
];
|
];
|
||||||
|
|
||||||
var ws = new ReconnectingWebSocket('ws://' + address + ':81/', ['arduino']);
|
var ws = new ReconnectingWebSocket('ws://' + address + ':81/', ['arduino']);
|
||||||
@ -131,13 +114,13 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function addColorButtons() {
|
function addColorButtons() {
|
||||||
var hues = 30;
|
var hues = 25;
|
||||||
var hueStep = 360 / hues;
|
var hueStep = 360 / hues;
|
||||||
|
|
||||||
var levels = 25;
|
var levels = 10;
|
||||||
var levelStep = 50 / levels;
|
var levelStep = 60 / levels;
|
||||||
|
|
||||||
for(var l = 50; l < 95; l += levelStep) {
|
for(var l = 20; l < 80; l += levelStep) {
|
||||||
for(var h = 0; h < hues; h++) {
|
for(var h = 0; h < hues; h++) {
|
||||||
addColorButton(h * hueStep, 100, l);
|
addColorButton(h * hueStep, 100, l);
|
||||||
}
|
}
|
||||||
@ -148,35 +131,24 @@ function addColorButtons() {
|
|||||||
layoutMode: 'fitRows'
|
layoutMode: 'fitRows'
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.grid-color-buttons').isotope({
|
|
||||||
itemSelector: '.grid-item-color-button',
|
|
||||||
layoutMode: 'fitRows'
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.grid-item-color-button').click(colorButtonClick);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var colorButtonIndex = 0;
|
var colorButtonIndex = 0;
|
||||||
|
|
||||||
function colorButtonClick() {
|
function addColorButton(h, s, l) {
|
||||||
|
var color = "hsla(" + h + ", " + s + "%, " + l + "%, 1)"
|
||||||
|
var template = $("#colorButtonTemplate").clone();
|
||||||
|
template.attr("id", "color-button-" + colorButtonIndex++);
|
||||||
|
template.css("background-color", color);
|
||||||
|
template.click(function() {
|
||||||
var rgb = $(this).css('backgroundColor');
|
var rgb = $(this).css('backgroundColor');
|
||||||
var components = rgbToComponents(rgb);
|
var components = rgbToComponents(rgb);
|
||||||
|
|
||||||
$(".grid-item-color").css("border", "none");
|
$(".grid-item-color").css("border", "none");
|
||||||
|
|
||||||
if($(this).attr("class") === "grid-item-color") {
|
|
||||||
$(this).css("border", "1px solid");
|
$(this).css("border", "1px solid");
|
||||||
}
|
|
||||||
|
|
||||||
postColor("solidColor", components);
|
postColor("solidColor", components);
|
||||||
}
|
});
|
||||||
|
|
||||||
function addColorButton(h, s, l) {
|
|
||||||
var color = "hsl(" + h + ", " + s + "%, " + l + "%)"
|
|
||||||
var template = $("#colorButtonTemplate").clone();
|
|
||||||
template.css("background-color", color);
|
|
||||||
template.attr("title", template.css("background-color") + "\r\n" + color);
|
|
||||||
template.click(colorButtonClick);
|
|
||||||
|
|
||||||
$("#colorButtonsRow").append(template);
|
$("#colorButtonsRow").append(template);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<title>Cube by Evil Genius Labs</title>
|
<title>ESP8266 + FastLED by Evil Genius Labs</title>
|
||||||
|
|
||||||
<!-- request CSS from internet CDN -->
|
<!-- request CSS from internet CDN -->
|
||||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
@ -20,44 +20,22 @@
|
|||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="container" class="container-fluid">
|
<div id="container" class="container">
|
||||||
|
|
||||||
<div style="margin: 5px;">
|
<div style="margin: 5px;">
|
||||||
<button type="button" class="btn btn-default" id="btnOn">On</button>
|
<button type="button" class="btn btn-default" id="btnOn">On</button>
|
||||||
<button type="button" class="btn btn-default" id="btnOff">Off</button>
|
<button type="button" class="btn btn-default" id="btnOff">Off</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h4>Patterns</h4>
|
|
||||||
|
|
||||||
<div id="patternGrid" class="grid-pattern"></div>
|
<div id="patternGrid" class="grid-pattern"></div>
|
||||||
|
|
||||||
<h4>Basic Colors</h4>
|
|
||||||
|
|
||||||
<div class="grid-color-buttons">
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #FF0000;" title="Red"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #FF8000;" title="Orange"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #FFFF00;" title="Yellow"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #80FF00;" title="Chartreuse"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #00FF00;" title="Green"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #00FF80;" title="Spring Green"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #00FFFF;" title="Cyan"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #0080FF;" title="Azure"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #0000FF;" title="Blue"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #8000FF;" title="Violet"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #FF00FF;" title="Magenta"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #FF0080;" title="Rose"> </button>
|
|
||||||
<button type="button" class="grid-item-color-button" style="background: #FFFFFF; border: 1px solid;" title="White"> </button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<h4>Color Palette</h4>
|
|
||||||
|
|
||||||
<div id="colorButtonsRow" class="grid-color"></div>
|
<div id="colorButtonsRow" class="grid-color"></div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="templates" style="display: none">
|
<div id="templates" style="display: none">
|
||||||
|
|
||||||
<button id="colorButtonTemplate" class="grid-item-color"></button>
|
<div id="colorButtonTemplate" class="grid-item-color"></div>
|
||||||
|
|
||||||
<button id="patternButtonTemplate" class="grid-item-pattern btn btn-default"></button>
|
<button id="patternButtonTemplate" class="grid-item-pattern btn btn-default"></button>
|
||||||
|
|
||||||
|
95
data/wifi.htm
Normal file
95
data/wifi.htm
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>ESP8266 + FastLED by Evil Genius Labs</title>
|
||||||
|
|
||||||
|
<!-- request CSS from internet CDN -->
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
|
||||||
|
|
||||||
|
<!-- request CSS from the ESP8266 web server -->
|
||||||
|
<!-- <link rel="stylesheet" href="css/bootstrap.min.css"> -->
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="css/styles.css">
|
||||||
|
|
||||||
|
<link rel="icon" href="images/atom196.png">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-default navbar-static-top" id="top" role="banner">
|
||||||
|
<div class="container">
|
||||||
|
<div class="navbar-header">
|
||||||
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar-collapse-1" aria-expanded="false">
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
</button>
|
||||||
|
<a class="navbar-brand" href="https://www.evilgeniuslabs.org" target="_blank"><img src="/images/atom196.png" style="width: 24px; height: 24px;" /></a>
|
||||||
|
<a class="navbar-brand" href="https://www.evilgeniuslabs.org" target="_blank">Evil Genius Labs</a>
|
||||||
|
</div>
|
||||||
|
<div class="collapse navbar-collapse" id="navbar-collapse-1">
|
||||||
|
<ul class="nav navbar-nav">
|
||||||
|
<li><a href="/">ESP8266 + FastLED <span class="sr-only">(current)</span></a></li>
|
||||||
|
<li><a href="/simple.htm" target="_blank" title="Simple Mode">Simple</a></li>
|
||||||
|
<li><a href="/edit.htm" target="_blank" title="Edit Files">Files</a></li>
|
||||||
|
<li><a href="/update" target="_blank" title="Update Firmware">Firmware</a></li>
|
||||||
|
<li class="active"><a href="/wifi.htm" target="_blank" title="Wi-Fi Settings">Wi-Fi</a></li>
|
||||||
|
</ul>
|
||||||
|
<ul class="nav navbar-nav navbar-right">
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/jasoncoon/esp8266-fastled-webserver">
|
||||||
|
<img style="height: 16px;" src="/images/github.ico" />
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div id="container" class="container">
|
||||||
|
|
||||||
|
<form class="form-horizontal" id="form" action="/wifi" method="post">
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="inputSSID" class="col-sm-2 control-label">SSID</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="text" autocorrect="off" autocapitalize="none"
|
||||||
|
class="form-control" id="inputSSID" name="ssid" placeholder="SSID (Wi-Fi network name)">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="inputPassword" class="col-sm-2 control-label">Password</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<input type="password" class="form-control" id="inputPassword" name="password" placeholder="Password">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-sm-offset-2 col-sm-10">
|
||||||
|
<button type="submit" class="btn btn-default">Connect</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- request js from internet CDN -->
|
||||||
|
<script src="https://code.jquery.com/jquery-3.1.1.min.js" integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8=" crossorigin="anonymous"></script>
|
||||||
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
|
||||||
|
<!-- <script src="https://unpkg.com/isotope-layout@3/dist/isotope.pkgd.min.js"></script> -->
|
||||||
|
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/reconnecting-websocket/1.0.0/reconnecting-websocket.min.js" integrity="sha256-A4JwlcDvqO4JXpvEtvWY1RH8JAEMu5W21wP8GUXLUNs=" crossorigin="anonymous"></script> -->
|
||||||
|
|
||||||
|
<!-- request js from the ESP8266 web server -->
|
||||||
|
<!-- <script src="js/jquery-3.1.1.min.js"></script> -->
|
||||||
|
<!-- <script src="js/bootstrap.min.js"></script> -->
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
@ -1,23 +1,24 @@
|
|||||||
/*
|
/*
|
||||||
ESP8266 + FastLED + IR Remote: https://github.com/jasoncoon/esp8266-fastled-webserver
|
* ESP8266 + FastLED + IR Remote: https://github.com/jasoncoon/esp8266-fastled-webserver
|
||||||
Copyright (C) 2015-2017 Jason Coon
|
* Copyright (C) 2015-2016 Jason Coon
|
||||||
|
*
|
||||||
This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
(at your option) any later version.
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define FASTLED_INTERRUPT_RETRY_COUNT 1
|
||||||
//#define FASTLED_ALLOW_INTERRUPTS 0
|
//#define FASTLED_ALLOW_INTERRUPTS 0
|
||||||
#define FASTLED_INTERRUPT_RETRY_COUNT 0
|
|
||||||
#include <FastLED.h>
|
#include <FastLED.h>
|
||||||
FASTLED_USING_NAMESPACE
|
FASTLED_USING_NAMESPACE
|
||||||
|
|
||||||
@ -26,47 +27,38 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#include <ESP8266WiFi.h>
|
#include <ESP8266WiFi.h>
|
||||||
#include <ESP8266mDNS.h>
|
//#include <ESP8266mDNS.h>
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
#include <ESP8266HTTPUpdateServer.h>
|
#include <ESP8266HTTPUpdateServer.h>
|
||||||
#include <WebSocketsServer.h>
|
#include <WebSocketsServer.h>
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
//#include <IRremoteESP8266.h>
|
//#include <IRremoteESP8266.h>
|
||||||
|
#include "GradientPalettes.h"
|
||||||
|
|
||||||
#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
|
#define ARRAY_SIZE(A) (sizeof(A) / sizeof((A)[0]))
|
||||||
|
|
||||||
#include "Field.h"
|
#include "Field.h"
|
||||||
|
|
||||||
#define HOSTNAME "Cube-ESP8266-" ///< Hostname. The setup function adds the Chip ID at the end.
|
|
||||||
|
|
||||||
//#define RECV_PIN D4
|
//#define RECV_PIN D4
|
||||||
//IRrecv irReceiver(RECV_PIN);
|
//IRrecv irReceiver(RECV_PIN);
|
||||||
|
|
||||||
//#include "Commands.h"
|
//#include "Commands.h"
|
||||||
|
|
||||||
const bool apMode = false;
|
|
||||||
|
|
||||||
// AP mode password
|
|
||||||
const char WiFiAPPSK[] = "";
|
|
||||||
|
|
||||||
// Wi-Fi network to connect to (if not in AP mode)
|
|
||||||
const char* ssid = "";
|
|
||||||
const char* password = "";
|
|
||||||
|
|
||||||
ESP8266WebServer webServer(80);
|
ESP8266WebServer webServer(80);
|
||||||
WebSocketsServer webSocketsServer = WebSocketsServer(81);
|
WebSocketsServer webSocketsServer = WebSocketsServer(81);
|
||||||
ESP8266HTTPUpdateServer httpUpdateServer;
|
ESP8266HTTPUpdateServer httpUpdateServer;
|
||||||
|
|
||||||
|
#include "WiFi.h"
|
||||||
|
|
||||||
#include "FSBrowser.h"
|
#include "FSBrowser.h"
|
||||||
|
|
||||||
#define DATA_PIN D5
|
#define DATA_PIN D5
|
||||||
#define CLK_PIN D6
|
#define LED_TYPE WS2812
|
||||||
#define LED_TYPE APA102
|
#define COLOR_ORDER RGB
|
||||||
#define COLOR_ORDER BGR
|
#define NUM_LEDS 50
|
||||||
#define NUM_LEDS 8 * 8 * 6
|
|
||||||
|
|
||||||
#define MILLI_AMPS 2000 // IMPORTANT: set the max milli-Amps of your power supply (4A = 4000mA)
|
#define MILLI_AMPS 3000 // IMPORTANT: set the max milli-Amps of your power supply (4A = 4000mA)
|
||||||
#define FRAMES_PER_SECOND 120 // here you can control the speed. With the Access Point / Web Server the animations run a bit slower.
|
#define FRAMES_PER_SECOND 120 // here you can control the speed. With the Access Point / Web Server the animations run a bit slower.
|
||||||
|
|
||||||
CRGB leds[NUM_LEDS];
|
CRGB leds[NUM_LEDS];
|
||||||
@ -113,6 +105,72 @@ unsigned long autoPlayTimeout = 0;
|
|||||||
|
|
||||||
uint8_t currentPaletteIndex = 0;
|
uint8_t currentPaletteIndex = 0;
|
||||||
|
|
||||||
|
uint8_t gHue = 0; // rotating "base color" used by many of the patterns
|
||||||
|
|
||||||
|
CRGB solidColor = CRGB::Blue;
|
||||||
|
|
||||||
|
// scale the brightness of all pixels down
|
||||||
|
void dimAll(byte value)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < NUM_LEDS; i++) {
|
||||||
|
leds[i].nscale8(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
typedef void (*Pattern)();
|
||||||
|
typedef Pattern PatternList[];
|
||||||
|
typedef struct {
|
||||||
|
Pattern pattern;
|
||||||
|
String name;
|
||||||
|
} PatternAndName;
|
||||||
|
typedef PatternAndName PatternAndNameList[];
|
||||||
|
|
||||||
|
#include "Twinkles.h"
|
||||||
|
#include "TwinkleFOX.h"
|
||||||
|
|
||||||
|
// List of patterns to cycle through. Each is defined as a separate function below.
|
||||||
|
|
||||||
|
PatternAndNameList patterns = {
|
||||||
|
{ pride, "Pride" },
|
||||||
|
{ colorWaves, "Color Waves" },
|
||||||
|
|
||||||
|
// twinkle patterns
|
||||||
|
{ rainbowTwinkles, "Rainbow Twinkles" },
|
||||||
|
{ snowTwinkles, "Snow Twinkles" },
|
||||||
|
{ cloudTwinkles, "Cloud Twinkles" },
|
||||||
|
{ incandescentTwinkles, "Incandescent Twinkles" },
|
||||||
|
|
||||||
|
// TwinkleFOX patterns
|
||||||
|
{ retroC9Twinkles, "Retro C9 Twinkles" },
|
||||||
|
{ redWhiteTwinkles, "Red & White Twinkles" },
|
||||||
|
{ blueWhiteTwinkles, "Blue & White Twinkles" },
|
||||||
|
{ redGreenWhiteTwinkles, "Red, Green & White Twinkles" },
|
||||||
|
{ fairyLightTwinkles, "Fairy Light Twinkles" },
|
||||||
|
{ snow2Twinkles, "Snow 2 Twinkles" },
|
||||||
|
{ hollyTwinkles, "Holly Twinkles" },
|
||||||
|
{ iceTwinkles, "Ice Twinkles" },
|
||||||
|
{ partyTwinkles, "Party Twinkles" },
|
||||||
|
{ forestTwinkles, "Forest Twinkles" },
|
||||||
|
{ lavaTwinkles, "Lava Twinkles" },
|
||||||
|
{ fireTwinkles, "Fire Twinkles" },
|
||||||
|
{ cloud2Twinkles, "Cloud 2 Twinkles" },
|
||||||
|
{ oceanTwinkles, "Ocean Twinkles" },
|
||||||
|
|
||||||
|
{ rainbow, "Rainbow" },
|
||||||
|
{ rainbowWithGlitter, "Rainbow With Glitter" },
|
||||||
|
{ rainbowSolid, "Solid Rainbow" },
|
||||||
|
{ confetti, "Confetti" },
|
||||||
|
{ sinelon, "Sinelon" },
|
||||||
|
{ bpm, "Beat" },
|
||||||
|
{ juggle, "Juggle" },
|
||||||
|
{ fire, "Fire" },
|
||||||
|
{ water, "Water" },
|
||||||
|
|
||||||
|
{ showSolidColor, "Solid Color" }
|
||||||
|
};
|
||||||
|
|
||||||
|
const uint8_t patternCount = ARRAY_SIZE(patterns);
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
CRGBPalette16 palette;
|
CRGBPalette16 palette;
|
||||||
String name;
|
String name;
|
||||||
@ -143,131 +201,15 @@ const String paletteNames[paletteCount] = {
|
|||||||
"Heat",
|
"Heat",
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "GradientPalettes.h"
|
|
||||||
|
|
||||||
uint8_t gHue = 0; // rotating "base color" used by many of the patterns
|
|
||||||
|
|
||||||
CRGB solidColor = CRGB::Blue;
|
|
||||||
|
|
||||||
// scale the brightness of all pixels down
|
|
||||||
void dimAll(byte value)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < NUM_LEDS; i++) {
|
|
||||||
leds[i].nscale8(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef void (*Pattern)();
|
|
||||||
typedef Pattern PatternList[];
|
|
||||||
typedef struct {
|
|
||||||
Pattern pattern;
|
|
||||||
String name;
|
|
||||||
} PatternAndName;
|
|
||||||
typedef PatternAndName PatternAndNameList[];
|
|
||||||
|
|
||||||
#include "Twinkles.h"
|
|
||||||
#include "TwinkleFOX.h"
|
|
||||||
#include "Map.h"
|
|
||||||
#include "Noise.h"
|
|
||||||
|
|
||||||
// List of patterns to cycle through. Each is defined as a separate function below.
|
|
||||||
|
|
||||||
PatternAndNameList patterns = {
|
|
||||||
{ pride, "Pride" },
|
|
||||||
{ colorWaves, "Color Waves" },
|
|
||||||
|
|
||||||
{ rainbowWavesFall, "Rainbow Waves Fall" },
|
|
||||||
{ rainbowWavesRise, "Rainbow Waves Rise" },
|
|
||||||
|
|
||||||
{ 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" },
|
|
||||||
{ fireNoise23d, "Fire Noise 2" },
|
|
||||||
{ lavaNoise3d, "Lava Noise" },
|
|
||||||
{ rainbowNoise3d, "Rainbow Noise" },
|
|
||||||
{ rainbowStripeNoise3d, "Rainbow Stripe Noise" },
|
|
||||||
{ partyNoise3d, "Party Noise" },
|
|
||||||
{ forestNoise3d, "Forest Noise" },
|
|
||||||
{ cloudNoise3d, "Cloud Noise" },
|
|
||||||
{ oceanNoise3d, "Ocean Noise" },
|
|
||||||
{ blackAndWhiteNoise3d, "Black & White Noise" },
|
|
||||||
{ blackAndBlueNoise3d, "Black & Blue Noise" },
|
|
||||||
|
|
||||||
// twinkle patterns
|
|
||||||
{ rainbowTwinkles, "Rainbow Twinkles" },
|
|
||||||
{ snowTwinkles, "Snow Twinkles" },
|
|
||||||
{ cloudTwinkles, "Cloud Twinkles" },
|
|
||||||
{ incandescentTwinkles, "Incandescent Twinkles" },
|
|
||||||
|
|
||||||
// TwinkleFOX patterns
|
|
||||||
{ retroC9Twinkles, "Retro C9 Twinkles" },
|
|
||||||
{ redWhiteTwinkles, "Red & White Twinkles" },
|
|
||||||
{ blueWhiteTwinkles, "Blue & White Twinkles" },
|
|
||||||
{ redGreenWhiteTwinkles, "Red, Green & White Twinkles" },
|
|
||||||
{ fairyLightTwinkles, "Fairy Light Twinkles" },
|
|
||||||
{ snow2Twinkles, "Snow 2 Twinkles" },
|
|
||||||
{ hollyTwinkles, "Holly Twinkles" },
|
|
||||||
{ iceTwinkles, "Ice Twinkles" },
|
|
||||||
{ partyTwinkles, "Party Twinkles" },
|
|
||||||
{ forestTwinkles, "Forest Twinkles" },
|
|
||||||
{ lavaTwinkles, "Lava Twinkles" },
|
|
||||||
{ fireTwinkles, "Fire Twinkles" },
|
|
||||||
{ cloud2Twinkles, "Cloud 2 Twinkles" },
|
|
||||||
{ oceanTwinkles, "Ocean Twinkles" },
|
|
||||||
|
|
||||||
// { rainbow, "Rainbow" },
|
|
||||||
// { rainbowWithGlitter, "Rainbow With Glitter" },
|
|
||||||
{ rainbowSolid, "Solid Rainbow" },
|
|
||||||
{ confetti, "Confetti" },
|
|
||||||
{ sinelon, "Sinelon" },
|
|
||||||
{ bpm, "Beat" },
|
|
||||||
{ juggle, "Juggle" },
|
|
||||||
// { fire, "Fire" },
|
|
||||||
// { water, "Water" },
|
|
||||||
|
|
||||||
{ strandTest, "Strand Test" },
|
|
||||||
|
|
||||||
{ showSolidColor, "Solid Color" }
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint8_t patternCount = ARRAY_SIZE(patterns);
|
|
||||||
|
|
||||||
#include "Fields.h"
|
#include "Fields.h"
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
WiFi.setSleepMode(WIFI_NONE_SLEEP);
|
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
delay(100);
|
delay(100);
|
||||||
Serial.setDebugOutput(true);
|
Serial.setDebugOutput(true);
|
||||||
|
|
||||||
// FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS); // for WS2812 (Neopixel)
|
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS); // for WS2812 (Neopixel)
|
||||||
FastLED.addLeds<LED_TYPE,DATA_PIN,CLK_PIN,COLOR_ORDER>(leds, NUM_LEDS); // for APA102 (Dotstar)
|
//FastLED.addLeds<LED_TYPE,DATA_PIN,CLK_PIN,COLOR_ORDER>(leds, NUM_LEDS); // for APA102 (Dotstar)
|
||||||
FastLED.setDither(false);
|
FastLED.setDither(false);
|
||||||
FastLED.setCorrection(TypicalLEDStrip);
|
FastLED.setCorrection(TypicalLEDStrip);
|
||||||
FastLED.setBrightness(brightness);
|
FastLED.setBrightness(brightness);
|
||||||
@ -304,57 +246,7 @@ void setup() {
|
|||||||
Serial.printf("\n");
|
Serial.printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set Hostname.
|
initializeWiFi();
|
||||||
String hostname(HOSTNAME);
|
|
||||||
hostname += String(ESP.getChipId(), HEX);
|
|
||||||
WiFi.hostname(hostname);
|
|
||||||
|
|
||||||
char hostnameChar[hostname.length() + 1];
|
|
||||||
memset(hostnameChar, 0, hostname.length() + 1);
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < hostname.length(); i++)
|
|
||||||
hostnameChar[i] = hostname.charAt(i);
|
|
||||||
|
|
||||||
MDNS.begin(hostnameChar);
|
|
||||||
|
|
||||||
// Add service to MDNS-SD
|
|
||||||
MDNS.addService("http", "tcp", 80);
|
|
||||||
|
|
||||||
// Print hostname.
|
|
||||||
Serial.println("Hostname: " + hostname);
|
|
||||||
|
|
||||||
if (apMode)
|
|
||||||
{
|
|
||||||
WiFi.mode(WIFI_AP);
|
|
||||||
|
|
||||||
// Do a little work to get a unique-ish name. Append the
|
|
||||||
// last two bytes of the MAC (HEX'd) to "Thing-":
|
|
||||||
uint8_t mac[WL_MAC_ADDR_LENGTH];
|
|
||||||
WiFi.softAPmacAddress(mac);
|
|
||||||
String macID = String(mac[WL_MAC_ADDR_LENGTH - 2], HEX) +
|
|
||||||
String(mac[WL_MAC_ADDR_LENGTH - 1], HEX);
|
|
||||||
macID.toUpperCase();
|
|
||||||
String AP_NameString = "ESP8266-" + macID;
|
|
||||||
|
|
||||||
char AP_NameChar[AP_NameString.length() + 1];
|
|
||||||
memset(AP_NameChar, 0, AP_NameString.length() + 1);
|
|
||||||
|
|
||||||
for (int i = 0; i < AP_NameString.length(); i++)
|
|
||||||
AP_NameChar[i] = AP_NameString.charAt(i);
|
|
||||||
|
|
||||||
WiFi.softAP(AP_NameChar, WiFiAPPSK);
|
|
||||||
|
|
||||||
Serial.printf("Connect to Wi-Fi access point: %s\n", AP_NameChar);
|
|
||||||
Serial.println("and open http://192.168.4.1 in your browser");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
WiFi.mode(WIFI_STA);
|
|
||||||
Serial.printf("Connecting to %s\n", ssid);
|
|
||||||
if (String(WiFi.SSID()) != String(ssid)) {
|
|
||||||
WiFi.begin(ssid, password);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
httpUpdateServer.setup(&webServer);
|
httpUpdateServer.setup(&webServer);
|
||||||
|
|
||||||
@ -525,6 +417,7 @@ void loop() {
|
|||||||
// Add entropy to random number generator; we use a lot of it.
|
// Add entropy to random number generator; we use a lot of it.
|
||||||
random16_add_entropy(random(65535));
|
random16_add_entropy(random(65535));
|
||||||
|
|
||||||
|
// dnsServer.processNextRequest();
|
||||||
webSocketsServer.loop();
|
webSocketsServer.loop();
|
||||||
webServer.handleClient();
|
webServer.handleClient();
|
||||||
|
|
||||||
@ -1053,7 +946,7 @@ void sinelon()
|
|||||||
{
|
{
|
||||||
// a colored dot sweeping back and forth, with fading trails
|
// a colored dot sweeping back and forth, with fading trails
|
||||||
fadeToBlackBy( leds, NUM_LEDS, 20);
|
fadeToBlackBy( leds, NUM_LEDS, 20);
|
||||||
int pos = beatsin16(speed, 0, NUM_LEDS);
|
int pos = beatsin16(speed, 0, NUM_LEDS - 1);
|
||||||
static int prevpos = 0;
|
static int prevpos = 0;
|
||||||
CRGB color = ColorFromPalette(palettes[currentPaletteIndex], gHue, 255);
|
CRGB color = ColorFromPalette(palettes[currentPaletteIndex], gHue, 255);
|
||||||
if( pos < prevpos ) {
|
if( pos < prevpos ) {
|
||||||
@ -1179,7 +1072,7 @@ void heatMap(CRGBPalette16 palette, bool up)
|
|||||||
random16_add_entropy(random(256));
|
random16_add_entropy(random(256));
|
||||||
|
|
||||||
// Array of temperature readings at each simulation cell
|
// Array of temperature readings at each simulation cell
|
||||||
static byte heat[NUM_LEDS];
|
static byte heat[256];
|
||||||
|
|
||||||
byte colorindex;
|
byte colorindex;
|
||||||
|
|
||||||
@ -1309,254 +1202,3 @@ void palettetest( CRGB* ledarray, uint16_t numleds, const CRGBPalette16& gCurren
|
|||||||
startindex--;
|
startindex--;
|
||||||
fill_palette( ledarray, numleds, startindex, (256 / NUM_LEDS) + 1, gCurrentPalette, 255, LINEARBLEND);
|
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.
Before Width: | Height: | Size: 104 KiB |
BIN
ultim8x8.png
BIN
ultim8x8.png
Binary file not shown.
Before Width: | Height: | Size: 45 KiB |
Reference in New Issue
Block a user