Compare commits

...

6 Commits

Author SHA1 Message Date
Jason Coon
fc37d728ca Improved XYZ maps 2017-10-21 12:58:39 -05:00
Jason Coon
623a03baa2 Added vertically aligned z map, more patterns, etc. 2017-10-21 09:19:07 -05:00
Jason Coon
9b6f17b81c Added animated gif. 2017-10-17 21:18:33 -05:00
Jason Coon
23dac4bb7c Ported from TinyTiM to ULTiM8x8 Cube 2017-10-17 21:04:27 -05:00
Jason Coon
9025d0ed10 Updated for 8x8x8 tinytim cube. 2017-09-05 07:59:24 -05:00
Jason Coon
3a3bb2043c Added support for 6 panel tinytim cube. 2017-06-11 11:04:59 -05:00
13 changed files with 1086 additions and 323 deletions

165
Map.h Normal file
View File

@ -0,0 +1,165 @@
// 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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 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, 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, 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 Normal file
View File

@ -0,0 +1,212 @@
/*
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);
}

View File

@ -1,22 +1,48 @@
FastLED + ESP8266 Web Server
ULTiM8x8 Cube + FastLED + ESP8266 Web Server
=========
Control an addressable LED strip with an ESP8266 via a web browser or infrared remote control.
Control an RGB LED cube with an ESP8266 via a web browser.
[![ULTiM8x8 Cube + FastLED + ESP8266 Web Server](SCHDFGx.gif)](https://i.imgur.com/SCHDFGx.gifv)
Hardware
--------
An ESP8266 development board, such as the [Adafruit HUZZAH ESP8266 Breakout]:
##### ESP8266 development board
[![Adafruit HUZZAH ESP8266 Breakout](https://cdn-shop.adafruit.com/310x233/2471-10.jpg)](https://www.adafruit.com/products/2471)
[![Adafruit Feather HUZZAH with ESP8266 WiFi](https://cdn-shop.adafruit.com/145x109/2821-07.jpg)](https://www.adafruit.com/product/2821)
Addressable LED strip, such as the [Adafruit NeoPixel Ring]:
[Adafruit Feather HUZZAH with ESP8266 WiFi](https://www.adafruit.com/product/2821)
[![Adafruit NeoPixel Ring](https://www.adafruit.com/images/145x109/1586-00.jpg)](https://www.adafruit.com/product/1586)
or
[![Wemos D1 Mini Pro & Headers](https://ae01.alicdn.com/kf/HTB1P1KVaMsSMeJjSsphq6xuJFXah/WEMOS-D1-mini-Pro-V1-1-0-16M-bytes-external-antenna-connector-ESP8266-WIFI-Internet-of.jpg_200x200.jpg)](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
[![ULTiM8x8](ultim8x8.png)](http://wyolum.com/ultim8x8/)
[ULTiM8x8 RGB LED panels](http://wyolum.com/ultim8x8/)
Other hardware:
* [3.3V to 5V Logic Level Shifter](http://www.digikey.com/product-detail/en/texas-instruments/SN74HCT245N/296-1612-5-ND/277258) (required if LEDs "glitch")
Recommended by [Adafruit NeoPixel "Best Practices"](https://learn.adafruit.com/adafruit-neopixel-uberguide/best-practices) to help protect LEDs from current onrush:
* [1000µF Capacitor](http://www.digikey.com/product-detail/en/panasonic-electronic-components/ECA-1EM102/P5156-ND/245015)
* [300 to 500 Ohm resistor](https://www.digikey.com/product-detail/en/stackpole-electronics-inc/CF14JT470R/CF14JT470RCT-ND/1830342)
Optional shield to make everything more tidy:
[![Wemos D1 Mini ESP8266 LED & Level Shifter Shield](https://d3s5r33r268y59.cloudfront.net/13194/products/thumbs/2017-05-06T15:02:37.208Z-IMG_20170506_100623.jpg.114x76_q85_pad_rcrop.jpg)](https://www.tindie.com/products/jasoncoon/wemos-d1-mini-esp8266-led-and-level-shifter-shield/)
[Wemos D1 Mini ESP8266 LED & Level Shifter Shield](https://www.tindie.com/products/jasoncoon/wemos-d1-mini-esp8266-led-and-level-shifter-shield)
Features
--------
* Turn the NeoPixel Ring on and off
* Turn the LEDs on and off
* Adjust the brightness
* Change the display pattern
* Adjust the color
@ -41,7 +67,7 @@ The app is installed via the Arduino IDE which can be [downloaded here](https://
The app depends on the following libraries. They must either be downloaded from GitHub and placed in the Arduino 'libraries' folder, or installed as [described here](https://www.arduino.cc/en/Guide/Libraries) by using the Arduino library manager.
* [FastLED](https://github.com/FastLED/FastLED)
* [IRremoteESP8266](https://github.com/markszabo/IRremoteESP8266)
* [IRremoteESP8266](https://github.com/sebastienwarin/IRremoteESP8266)
* [Arduino WebSockets](https://github.com/Links2004/arduinoWebSockets)
Download the app code from GitHub using the green Clone or Download button from [the GitHub project main page](https://github.com/jasoncoon/esp8266-fastled-webserver) and click Download ZIP. Decompress the ZIP file in your Arduino sketch folder.
@ -71,7 +97,4 @@ The firmware implements basic [RESTful web services](https://en.wikipedia.org/wi
Infrared Remote Control
-----------------------
Control via infrared remote control is also supported, via the [ESP8266 port of the IRremote library](https://github.com/markszabo/IRremoteESP8266).
[Adafruit NeoPixel Ring]:https://www.adafruit.com/product/1586
[Adafruit HUZZAH ESP8266 Breakout]:https://www.adafruit.com/products/2471
Control via infrared remote control is also supported, via the [ESP8266 port of the IRremote library](https://github.com/sebastienwarin/IRremoteESP8266).

BIN
SCHDFGx.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 MiB

View File

@ -194,7 +194,7 @@ void drawTwinkles()
uint8_t backgroundBrightness = bg.getAverageLight();
for(uint8_t i = 0; i < NUM_LEDS; i++) {
for(uint16_t i = 0; i < NUM_LEDS; i++) {
CRGB& pixel = leds[i];
PRNG16 = (uint16_t)(PRNG16 * 2053) + 1384; // next 'random' number

View File

@ -2,10 +2,20 @@
padding-bottom: 70px;
}*/
.grid-item-color-button {
border: 0px;
width: 7.69%;
height: 64px;
margin: 0px;
padding: 0px;
}
.grid-item-color {
width: 4%;
border: none;
width: 3.33%;
height: 32px;
cursor: pointer;
margin: 0px;
padding: 0px;
}
.grid-item-pattern {

View File

@ -5,7 +5,7 @@
<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>
<title>Cube 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">
@ -36,7 +36,7 @@
</div>
<div class="collapse navbar-collapse" id="navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="/">ESP8266 + FastLED <span class="sr-only">(current)</span></a></li>
<li class="active"><a href="/">Cube <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>

View File

@ -3,7 +3,7 @@ var address = location.hostname;
var urlBase = "";
// used when hosting the site somewhere other than the ESP8266 (handy for testing without waiting forever to upload to SPIFFS)
// var address = "esp8266-1920f7.local";
// var address = "192.168.86.55";
// var urlBase = "http://" + address + "/";
var postColorTimer = {};

View File

@ -3,7 +3,7 @@ var address = location.hostname;
var urlBase = "";
// used when hosting the site somewhere other than the ESP8266 (handy for testing without waiting forever to upload to SPIFFS)
// var address = "192.168.1.13";
// var address = "192.168.86.55";
// var urlBase = "http://" + address + "/";
var postColorTimer = {};
@ -15,6 +15,27 @@ var patterns = [
"Pride",
"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",
"Snow Twinkles",
"Cloud Twinkles",
@ -35,15 +56,11 @@ var patterns = [
"Cloud 2 Twinkles",
"Ocean Twinkles",
"Rainbow",
"Rainbow With Glitter",
"Solid Rainbow",
"Confetti",
"Sinelon",
"Beat",
"Juggle",
"Fire",
"Water"
];
var ws = new ReconnectingWebSocket('ws://' + address + ':81/', ['arduino']);
@ -114,13 +131,13 @@ $(document).ready(function() {
});
function addColorButtons() {
var hues = 25;
var hues = 30;
var hueStep = 360 / hues;
var levels = 10;
var levelStep = 60 / levels;
var levels = 25;
var levelStep = 50 / levels;
for(var l = 20; l < 80; l += levelStep) {
for(var l = 50; l < 95; l += levelStep) {
for(var h = 0; h < hues; h++) {
addColorButton(h * hueStep, 100, l);
}
@ -131,24 +148,35 @@ function addColorButtons() {
layoutMode: 'fitRows'
});
$('.grid-color-buttons').isotope({
itemSelector: '.grid-item-color-button',
layoutMode: 'fitRows'
});
$('.grid-item-color-button').click(colorButtonClick);
}
var colorButtonIndex = 0;
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 components = rgbToComponents(rgb);
function colorButtonClick() {
var rgb = $(this).css('backgroundColor');
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");
}
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);
}

View File

@ -5,7 +5,7 @@
<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>
<title>Cube 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">
@ -20,22 +20,44 @@
<body>
<div id="container" class="container">
<div id="container" class="container-fluid">
<div style="margin: 5px;">
<button type="button" class="btn btn-default" id="btnOn">On</button>
<button type="button" class="btn btn-default" id="btnOff">Off</button>
</div>
<h4>Patterns</h4>
<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">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #FF8000;" title="Orange">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #FFFF00;" title="Yellow">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #80FF00;" title="Chartreuse">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #00FF00;" title="Green">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #00FF80;" title="Spring Green">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #00FFFF;" title="Cyan">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #0080FF;" title="Azure">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #0000FF;" title="Blue">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #8000FF;" title="Violet">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #FF00FF;" title="Magenta">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #FF0080;" title="Rose">&nbsp;</button>
<button type="button" class="grid-item-color-button" style="background: #FFFFFF; border: 1px solid;" title="White">&nbsp;</button>
</div>
<h4>Color Palette</h4>
<div id="colorButtonsRow" class="grid-color"></div>
</div>
<div id="templates" style="display: none">
<div id="colorButtonTemplate" class="grid-item-color"></div>
<button id="colorButtonTemplate" class="grid-item-color"></button>
<button id="patternButtonTemplate" class="grid-item-pattern btn btn-default"></button>

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
ultim8x8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB