Compare commits

...

9 Commits
3.0 ... master

Author SHA1 Message Date
Lorenz Nimmervoll
8d6eafe8bf
Merge pull request #29 from WarDrake/mDNS
Adding mDNS ability to the webserver to avoid looking for the ip
2020-04-11 10:28:16 +02:00
Lorenz Nimmervoll
ad1f758acf
Merge pull request #27 from WarDrake/solid_colors_fix
Changing Index based selection on solid color pattern for name based …
2020-04-11 10:17:14 +02:00
Hary Ayala
543dd80f76 Adding mDNS ability to the webserver to avoid looking for the ip 2020-04-11 01:34:35 -06:00
Hary Ayala
20dd058162 Changing Index based selection on solid color pattern for name based one. 2020-04-11 00:43:38 -06:00
Lorenz Nimmervoll
b4afca5630 fixed issue with with compiling when using no alexa stuff, added espalexa.loop() to the main loop 2020-02-03 16:40:16 +01:00
Lorenz Nimmervoll
fd5a5a70de mini hotfixes 2020-02-01 10:26:08 +01:00
Lorenz Nimmervoll
83e7526828 removed option for custom patterns 2020-02-01 10:18:45 +01:00
Lorenz Nimmervoll
53ba768849 Merge branch 'master' of https://github.com/NimmLor/esp8266-nanoleaf-webserver 2020-02-01 09:51:31 +01:00
Lorenz Nimmervoll
794b36b2db added note for pin mapping of other boards 2020-02-01 09:51:11 +01:00
2 changed files with 22 additions and 11 deletions

View File

@ -53,7 +53,7 @@ For beginners I would recommend watching this setup tutorial below.
## 2. Software Configuration
1. Download the Project from the [Releases at Github]( https://github.com/NimmLor/esp8266-fastled-desk-light/releases ) and extract the archive
1. Download the Project from the [Releases at Github]( https://github.com/NimmLor/esp8266-nanoleaf-webserver/releases ) and extract the archive
2. Open the **.ino** file inside the folder in the Arduino IDE
@ -77,7 +77,7 @@ For beginners I would recommend watching this setup tutorial below.
5. Configure the parameters
In the .ino file there are many parameters to change and tweak the essential settings are:
- `DATA_PIN`: The pin where the LED-Strip is connected
- `DATA_PIN`: The pin where the LED-Strip is connected (Note: If you are using another controller such as a clone or a NodeMCU board, you may need to configure the pin assignment for FastLED, See also [this entry in the FastLED Wiki](https://github.com/FastLED/FastLED/wiki/ESP8266-notes))
- `LED_TYPE`: The type of LED strip that is used (WS2812B, WS2811, ...)
@ -86,8 +86,7 @@ For beginners I would recommend watching this setup tutorial below.
- `LEDS_PER_LINE`: Amount of LEDs inside **1x** slot of the core
- `SOUND_REACTIVE`: Uncomment to enable a sound reactive pattern when using a sound sensor
- `SENSOR_TYPE`: Model of the [Sensor](http://s.click.aliexpress.com/e/_sYiUrz) used
- `SENSOR_TYPE`: Model of the [Sensor](http://s.click.aliexpress.com/e/_sYiUrz) used
- `ENABLE_ALEXA_SUPPORT`: Uncomment to disable the Amazon Alexa Support

View File

@ -28,7 +28,7 @@ extern "C" {
#include <EEPROM.h>
#include "GradientPalettes.h"
#include "Field.h"
#include <ESP8266mDNS.h> //Enable mDNS availability
/*######################## MAIN CONFIG ########################*/
@ -228,9 +228,7 @@ PatternAndNameList patterns = {
{ cloud2Twinkles, "Cloud 2 Twinkles" },
{ oceanTwinkles, "Ocean Twinkles" },
{ showSolidColor, "Solid Color" },
{ SetCustomPattern, "Custom Pattern"}
{ showSolidColor, "Solid Color" }
};
const uint8_t patternCount = ARRAY_SIZE(patterns);
@ -488,7 +486,9 @@ void setup() {
String g = webServer.arg("g");
String b = webServer.arg("b");
setSolidColor(r.toInt(), g.toInt(), b.toInt());
#ifdef ENABLE_ALEXA_SUPPORT
alexa_main->setColor(r.toInt(), g.toInt(), b.toInt());
#endif
sendString(String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b));
});
@ -519,7 +519,9 @@ void setup() {
webServer.on("/brightness", HTTP_POST, []() {
String value = webServer.arg("value");
setBrightness(value.toInt());
#ifdef ENABLE_ALEXA_SUPPORT
alexa_main->setValue(brightness);
#endif
sendInt(brightness);
});
@ -614,13 +616,17 @@ void broadcastString(String name, String value)
}
void loop() {
MDNS.update();
// Add entropy to random number generator; we use a lot of it.
random16_add_entropy(random(65535));
// dnsServer.processNextRequest();
// webSocketsServer.loop();
#ifdef ENABLE_ALEXA_SUPPORT
espalexa.loop();
#else
webServer.handleClient();
#endif
// handleIrInput();
if (power == 0) {
@ -640,7 +646,13 @@ void loop() {
hasConnected = true;
Serial.print("Connected! Open http://");
Serial.print(WiFi.localIP());
Serial.println(" in your browser");
Serial.println(" in your browser \n");
if (!MDNS.begin(HOSTNAME)) {
Serial.println("Error setting up MDNS responder! \n");
} else {
Serial.println("mDNS responder started \n");
MDNS.addService("http", "tcp", 80);
}
}
}
@ -821,7 +833,7 @@ void setSolidColor(uint8_t r, uint8_t g, uint8_t b)
EEPROM.write(4, b);
EEPROM.commit();
setPattern(29);
setPatternName("Solid Color");
broadcastString("color", String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b));
FastLED.show();