kitesurfer1404 / ws2812fx Goto Github PK
View Code? Open in Web Editor NEWWS2812 FX Library for Arduino and ESP8266
License: MIT License
WS2812 FX Library for Arduino and ESP8266
License: MIT License
Look like that the values are inverted, when i write:
...
ws2812fx.setColor(255, 255, 255);
...
the led is black. And if i set one value to 0, that color light up.
What do i wrong?
Arduino: 1.8.5 (Mac OS X), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"
In file included from /Users/buikhanh/Documents/Arduino/libraries/WS2812FX/WS2812FX.h:40:0,
from /Users/buikhanh/Documents/Arduino/libraries/WS2812FX/WS2812FX.cpp:54:
/Users/buikhanh/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h: In member function 'void WS2812FX::setLength(uint16_t)':
/Users/buikhanh/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h:159:5: error: 'uint16_t Adafruit_NeoPixel::numLEDs' is private
numLEDs, // Number of RGB LEDs in strip
^
/Users/buikhanh/Documents/Arduino/libraries/WS2812FX/WS2812FX.cpp:154:31: error: within this context
} while(!Adafruit_NeoPixel::numLEDs && b > 1);
^
In file included from /Users/buikhanh/Documents/Arduino/libraries/WS2812FX/WS2812FX.h:40:0,
from /Users/buikhanh/Documents/Arduino/libraries/WS2812FX/WS2812FX.cpp:54:
/Users/buikhanh/Documents/Arduino/libraries/Adafruit_NeoPixel/Adafruit_NeoPixel.h:159:5: error: 'uint16_t Adafruit_NeoPixel::numLEDs' is private
numLEDs, // Number of RGB LEDs in strip
^
/Users/buikhanh/Documents/Arduino/libraries/WS2812FX/WS2812FX.cpp:157:42: error: within this context
_segments[0].stop = Adafruit_NeoPixel::numLEDs - 1;
^
exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
The program runs error-free on an ESP8266.
On an ESP32 different Leds flicker, or stay on.
Test with ws2812 and ws2813.
I really like your project.
But I wounder if there are any possibility to control it from external webpage with post och get function.
I´m don´t have the knowledge to figure it out.
I want to control it from a Vera home automation controller.
Thanks.
Working off of the latest master branch, and also the lib included in the PIO repos.
The following build error happens:
[Tue Sep 12 18:07:05 2017] Processing nodemcuv2 (platform: espressif8266; lib_deps: git+https://github.com/marvinroger/homie-esp8266.git#develop, git+https://github.com/kitesurfer1404/WS2812FX.git#master; board: nodemcuv2; framework: arduino)
------------------------------------------------------------------------------------------------------------------------
Library Storage: [...]/170912-155002-nodemcuv2/.piolibdeps
LibraryManager: Installing homie-esp8266
Homie @ 5470b1b is already installed
Installing dependencies
Looking for ArduinoJson library in registry
Found: http://platformio.org/lib/show/64/ArduinoJson
LibraryManager: Installing id=64 @ ^5.10.0
ArduinoJson @ 5.11.1 is already installed
Looking for AsyncMqttClient library in registry
Found: http://platformio.org/lib/show/346/AsyncMqttClient
LibraryManager: Installing id=346 @ ^0.8.0
AsyncMqttClient @ 0.8.1 is already installed
Installing dependencies
Looking for ESPAsyncTCP library in registry
Found: http://platformio.org/lib/show/305/ESPAsyncTCP
LibraryManager: Installing id=305 @ ^1.0.1
ESPAsyncTCP @ 1.1.0 is already installed
Looking for Bounce2 library in registry
Found: http://platformio.org/lib/show/1106/Bounce2
LibraryManager: Installing id=1106 @ ^2.1.0
Bounce2 @ 2.1 is already installed
LibraryManager: Installing WS2812FX
WS2812FX @ 923123e is already installed
Installing dependencies
Looking for Adafruit NeoPixel library in registry
Found: http://platformio.org/lib/show/28/Adafruit NeoPixel
LibraryManager: Installing id=28 @ ~1.0.6
Adafruit NeoPixel @ 1.0.7 is already installed
Collected 46 compatible libraries
Looking for dependencies...
Library Dependency Graph
|-- <Homie> v2.0.0 ([...]/170912-155002-nodemcuv2/.piolibdeps/Homie)
| |-- <ArduinoJson> v5.11.1 ([...]/170912-155002-nodemcuv2/.piolibdeps/ArduinoJson_ID64)
| |-- <AsyncMqttClient> v0.8.1 ([...]/170912-155002-nodemcuv2/.piolibdeps/AsyncMqttClient_ID346)
| | |-- <ESPAsyncTCP> v1.1.0 ([...]/170912-155002-nodemcuv2/.piolibdeps/ESPAsyncTCP_ID305)
| | | |-- <ESP8266WiFi> v1.0 ([...]/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi)
| |-- <Bounce2> v2.1 ([...]/170912-155002-nodemcuv2/.piolibdeps/Bounce2_ID1106)
| |-- <ESP8266WebServer> v1.0 ([...]/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WebServer)
| | |-- <ESP8266WiFi> v1.0 ([...]/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi)
| |-- <ESP8266HTTPClient> v1.1 ([...]/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266HTTPClient)
| | |-- <ESP8266WiFi> v1.0 ([...]/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi)
| |-- <ESP8266mDNS> ([...]/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266mDNS)
| | |-- <ESP8266WiFi> v1.0 ([...]/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi)
| |-- <DNSServer> v1.1.0 ([...]/.platformio/packages/framework-arduinoespressif8266/libraries/DNSServer)
| | |-- <ESP8266WiFi> v1.0 ([...]/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi)
| |-- <Ticker> v1.0 ([...]/.platformio/packages/framework-arduinoespressif8266/libraries/Ticker)
| |-- <ESP8266WiFi> v1.0 ([...]/.platformio/packages/framework-arduinoespressif8266/libraries/ESP8266WiFi)
|-- <WS2812FX> v1.0.0 ([...]/170912-155002-nodemcuv2/.piolibdeps/WS2812FX)
| |-- <Adafruit NeoPixel> v1.0.7 ([...]/170912-155002-nodemcuv2/.piolibdeps/Adafruit NeoPixel_ID28)
xtensa-lx106-elf-g++ -o .pioenvs/nodemcuv2/lib/WS2812FX/WS2812FX.o -c -fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30500 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_NODEMCU -U__STRICT_ANSI__ -I[...]/.platformio/packages/framework-arduinoespressif8266/tools/sdk/include -I[...]/.platformio/packages/framework-arduinoespressif8266/tools/sdk/lwip/include -I[...]/.platformio/packages/framework-arduinoespressif8266/cores/esp8266 -I[...]/.platformio/packages/framework-arduinoespressif8266/variants/nodemcu "-I.piolibdeps/Adafruit NeoPixel_ID28" -I.piolibdeps/WS2812FX .piolibdeps/WS2812FX/WS2812FX.cpp
In file included from .piolibdeps/WS2812FX/WS2812FX.h:41:0,
from .piolibdeps/WS2812FX/WS2812FX.cpp:54:
.piolibdeps/Adafruit NeoPixel_ID28/Adafruit_NeoPixel.h: In member function 'void WS2812FX::setLength(uint16_t)':
.piolibdeps/Adafruit NeoPixel_ID28/Adafruit_NeoPixel.h:159:5: error: 'uint16_t Adafruit_NeoPixel::numLEDs' is private
numLEDs, // Number of RGB LEDs in strip
^
.piolibdeps/WS2812FX/WS2812FX.cpp:158:31: error: within this context
} while(!Adafruit_NeoPixel::numLEDs && b > 1);
^
In file included from .piolibdeps/WS2812FX/WS2812FX.h:41:0,
from .piolibdeps/WS2812FX/WS2812FX.cpp:54:
.piolibdeps/Adafruit NeoPixel_ID28/Adafruit_NeoPixel.h:159:5: error: 'uint16_t Adafruit_NeoPixel::numLEDs' is private
numLEDs, // Number of RGB LEDs in strip
^
.piolibdeps/WS2812FX/WS2812FX.cpp:160:35: error: within this context
_led_count = Adafruit_NeoPixel::numLEDs;
^
*** [.pioenvs/nodemcuv2/lib/WS2812FX/WS2812FX.o] Error 1
============================================== [ERROR] Took 2.22 seconds ==============================================
Had to replace my path with [...]
, since it includes work-related information falling under an NDA. It replaces both my ~
folder (in case of /.platformio/
paths) and the path to my project (in case of /170912-155002-nodemcuv2/
paths).
Apparently there's some incompatibility with the version of Adafruit_Neopixel
pulled in by PIO itself.
I've had everything working using the basic examples you showed, but I get an error when using the serial and web examples.
When I complie using a DUO everything is fine, when I use the NodeMCU it reports an error...
section type conflict with __c
in looking into this it appears the apply() function is the issue and some definitions need to move to global and out of the function. esp8266/Arduino#2078
Is it worth addressing the problem if you are able to identify the cause?
Hi first thanks for this library was just what I was looking for but I have a problem with the hexadecimal colors, when requesting the color 0xFF0000 (red color) in the led strip this throws the color 0x00FF00 (green color), for example:
When I request 0xFF0000 -> serial print line: FF0000
When I request 0x00FF00 -> serial print line: FF00
Why is this? Why are the first two zeros removed?
thank you very much
The minimum and maximum are reversed, 255 = the minimum speed, if set to 1, it really puts 10 but this is the maximum speed.
Hi,
I have been trying to get your WS2812FX working with my ESP8266, but i get errors on compile ?
I am using:
name=Adafruit NeoPixel version=1.0.6
ESP8266 using Arduino 1.6.5 (Reluctant to update this as Adafruit_NeoPixel works with all my other projects)
Regards
Gaz
In file included from esp8266_webinterface.ino:43:0:
G:\DATA\Software - Data\Arduino_Sketchbooks\Sketchbook + PubSubClient V2.3\libraries\WS2812FX-master/WS2812FX.h:55:31: fatal error: Adafruit_NeoPixel.h: No such file or directory
#include <Adafruit_NeoPixel.h>
^
compilation terminated.
Error compiling.
Do you have a plain C implementation of all these effects not only for arduino-compatible hardware but for general use? I mean, something, you can use with stm32 or msp430 with just C compiller and without neopixel or fastled libraries, as they seem to be useless outside arduino environment.
If no - would you like me to make such an implementation?
Thank you very much for your project!
I use it in my project. If you're interested you can see here:
Would be nice to include standard method of writing to individual neo pixels in non effect mode.
Maybe there already could not see a specific function.
Dans
How I can change the led count in setup() or loop() void?
Thanks
hello sir, i want to add more effects. i am using arduino but when i open auto cycle mode it doesn't show .h files how can i edit this program????
Hi I was looking at the 3LED strings siuch as
ebay 100 x 3 led string
a hundred of these would make a nice array around .7m x 1m with 15 x 20 pixels. given you can by other volumes of these you can get a smaller or larger array.
equally you can cut up and join a 5M strip and then put end connecters to make an array.
So the interesting thing is could we run great effects on an array of lights rather than a single strip of lights? or even get a way to program a sort of moving image. (bit like the 80s with old computers and pixel graphics!)
Just a thought!
CLose this if not practical.
Hello my Stop button in web interface do nothing. I would very much like it to completely disable all the effects and the tape was turned off.
For a specific project I'd need to access the currently set LED brightness level.
This would work fine with "getBrightness" for most effects but doesn't work when using the "breath" or "fade" effects because these effects seem to set the Neopixel libraries brightness level themselves which has no relation to the overall brightness setting (limit) which is returned by "getBrightness".
Unfortunately this library replaces the "getBrightness" function of the Neopixel library so I had to patch my version and add a "getRealBrightness" function to return the currently set brightness value.
While this is one possible solution the other would be to avoid changing the "upstream" brightness level and adjust the brightness level in both the "breath" and "fade" modes by changing the pixel colors to the proper brightness-adjusted values, similar to what is being done for example in the "twinkle fade" mode among others. This would also avoid some brightness-flickering that currently seems to occur when adjusting the brightness level (limit) while running those two modes as the change causes an immediate brightness change until the effect triggers again and sets the proper effect-matching brightness.
For the first described solution ("getRealBrightness") I could submit a pull request. However I do think the second solution might be a better approach.
Hi,
I tried the branch version by Aircoookie but got the following on compiling.
I am using portable Arduino 1.8.0
I renamed the folder 'WS2812FX-master-fire' to keep it separate from your original.
Apologies if its something I am doing wrong.
Thanks
Gaz
Arduino: 1.8.0 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"
In file included from G:\DATA\Temporary\arduino-1.8.0 -1\portable\sketchbook\libraries\WS2812FX-master-fire\examples\esp8266_webinterface\esp8266_webinterface.ino:43:0:
G:\DATA\Temporary\arduino-1.8.0 -1\portable\Sketchbook\libraries\WS2812FX-master-fire/WS2812FX.h:315:29: error: ISO C++ forbids declaration of 'mode_fire_flicker' with no type [-fpermissive]
mode_fire_flicker(void), ^
G:\DATA\Temporary\arduino-1.8.0 -1\portable\Sketchbook\libraries\WS2812FX-master-fire/WS2812FX.h:316:34: error: ISO C++ forbids declaration of 'mode_fire_flicker_soft' with no type [-fpermissive]
mode_fire_flicker_soft(void), ^
G:\DATA\Temporary\arduino-1.8.0 -1\portable\Sketchbook\libraries\WS2812FX-master-fire/WS2812FX.h:317:32: error: ISO C++ forbids declaration of 'mode_fire_flicker_int' with no type [-fpermissive]
mode_fire_flicker_int(int), ^
G:\DATA\Temporary\arduino-1.8.0 -1\portable\Sketchbook\libraries\WS2812FX-master-fire/WS2812FX.h:319:5: error: ISO C++ forbids declaration of 'boolean' with no type [-fpermissive]
boolean _running; ^
G:\DATA\Temporary\arduino-1.8.0 -1\portable\Sketchbook\libraries\WS2812FX-master-fire/WS2812FX.h:319:5: error: expected ';' at end of member declaration
G:\DATA\Temporary\arduino-1.8.0 -1\portable\Sketchbook\libraries\WS2812FX-master-fire/WS2812FX.h:319:5: error: declaration of 'int WS2812FX::boolean' [-fpermissive]
In file included from sketch\esp8266_webinterface.ino.cpp:1:0:
G:\DATA\Temporary\arduino-1.8.0 -1\portable\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/Arduino.h:186:17: error: changes meaning of 'boolean' from 'typedef uint8_t boolean' [-fpermissive]
typedef uint8_t boolean;
^
In file included from G:\DATA\Temporary\arduino-1.8.0 -1\portable\sketchbook\libraries\WS2812FX-master-fire\examples\esp8266_webinterface\esp8266_webinterface.ino:43:0:
G:\DATA\Temporary\arduino-1.8.0 -1\portable\Sketchbook\libraries\WS2812FX-master-fire/WS2812FX.h:319:13: error: '_running' does not name a type
boolean _running; ^
G:\DATA\Temporary\arduino-1.8.0 -1\portable\Sketchbook\libraries\WS2812FX-master-fire/WS2812FX.h: In constructor 'WS2812FX::WS2812FX(uint16_t, uint8_t, neoPixelType)':
G:\DATA\Temporary\arduino-1.8.0 -1\portable\Sketchbook\libraries\WS2812FX-master-fire/WS2812FX.h:171:44: error: cannot convert 'int (WS2812FX::)()' to 'WS2812FX::mode_ptr {aka void (WS2812FX::)()}' in assignment
_mode[FX_MODE_FIRE_FLICKER] = &WS2812FX::mode_fire_flicker; ^
G:\DATA\Temporary\arduino-1.8.0 -1\portable\Sketchbook\libraries\WS2812FX-master-fire/WS2812FX.h:172:44: error: cannot convert 'int (WS2812FX::)()' to 'WS2812FX::mode_ptr {aka void (WS2812FX::)()}' in assignment
_mode[FX_MODE_FIRE_FLICKER_SOFT] = &WS2812FX::mode_fire_flicker_soft; ^
G:\DATA\Temporary\arduino-1.8.0 -1\portable\Sketchbook\libraries\WS2812FX-master-fire/WS2812FX.h:226:7: error: '_running' was not declared in this scope
_running = false; ^
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Hi everyone.
I need a little help about my project
i'm using esp 8266 node mcu to control 2 button, DHT22 and ws2812 via node-red MQTT pubsubclient
the problem is my esp being hang and sometime it will reset the esp. sometime not.
i believe that the WS2112FX cause the hang.
here is my code. please help me fix it. i waste 2 days to find the problem but i fall in love with the effect of WS2812FX
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
#include <SoftwareSerial.h>
#include "DHT.h"
#include <Wire.h>
#include <WS2812FX.h>
#define LED_COUNT 216
#define LEDPIN D7
const int SPEED = 1000;
const char* ssid = "WifiChua";
const char* password = "xvideos.com";
const char* mqtt_server = "xxx.xxx.xx.xx";
int r;
int g;
int b;
const int Den_Pin1 = D1;
const int Den_Pin2 = D2;
const int Button1 = D5;
const int Button2 = D6;
int den1status = HIGH;
int den2status = HIGH;
int State1 = LOW;
int State2 = LOW;
//----------
#define DHTPIN D8
#define DHTTYPE DHT22
//boolean debug = false;
boolean debug = true;
WiFiClient espClientroom;
DHT dht(DHTPIN, DHTTYPE);
unsigned long lastMeasure = 0;
unsigned long lastMillis = 0;
WS2812FX ws2812fx = WS2812FX(LED_COUNT, LEDPIN, NEO_GRB + NEO_KHZ800);
//long lastMsg = 0;
//char msg[50];
//int value = 0;
PubSubClient client(espClientroom);
void nhand1(char* tp, byte* nd, unsigned int length) {
String topic(tp);
String noidung = String((char*)nd);
noidung.remove(length);
if (topic == "LED/dk")
{
const int EF = noidung.toInt();
switch (EF) {
case 1:
ws2812fx.setMode(FX_MODE_RAINBOW);
break;
case 2:
ws2812fx.setMode(FX_MODE_HALLOWEEN);
break;
case 3:
ws2812fx.setMode(FX_MODE_RANDOM_COLOR);
break;
case 4:
ws2812fx.setMode(FX_MODE_STATIC);
break;
case 5:
ws2812fx.setMode(FX_MODE_STATIC);
break;
case 6:
ws2812fx.setMode(FX_MODE_RAINBOW_CYCLE);
break;
case 7:
ws2812fx.setMode(FX_MODE_DUAL_SCAN);
break;
case 8:
ws2812fx.setMode(FX_MODE_CHASE_RAINBOW);
break;
case 9:
ws2812fx.setMode(FX_MODE_RUNNING_RANDOM);
break;
case 10:
ws2812fx.setMode(FX_MODE_CHASE_BLACKOUT_RAINBOW);
break;
case 11:
ws2812fx.setMode(FX_MODE_COLOR_SWEEP_RANDOM);
break;
case 12:
ws2812fx.setMode(FX_MODE_BLINK);
break;
case 13:
ws2812fx.setMode(FX_MODE_BREATH);
break;
case 14:
ws2812fx.setMode(FX_MODE_COLOR_WIPE);
break;
case 15:
ws2812fx.setMode(FX_MODE_COLOR_WIPE_INV);
break;
case 16:
ws2812fx.setMode(FX_MODE_COLOR_WIPE_REV);
break;
case 17:
ws2812fx.setMode(FX_MODE_COLOR_WIPE_REV_INV);
break;
case 18:
ws2812fx.setMode(FX_MODE_SINGLE_DYNAMIC);
break;
case 19:
ws2812fx.setMode(FX_MODE_MULTI_DYNAMIC);
break;
case 20:
ws2812fx.setMode(FX_MODE_SCAN);
break;
case 21:
ws2812fx.setMode(FX_MODE_FADE);
break;
case 22:
ws2812fx.setMode(FX_MODE_THEATER_CHASE);
break;
case 23:
ws2812fx.setMode(FX_MODE_THEATER_CHASE_RAINBOW);
break;
case 24:
ws2812fx.setMode(FX_MODE_RUNNING_LIGHTS);
break;
case 25:
ws2812fx.setMode(FX_MODE_TWINKLE);
break;
case 26:
ws2812fx.setMode(FX_MODE_TWINKLE_RANDOM);
break;
case 27:
ws2812fx.setMode(FX_MODE_TWINKLE_FADE);
break;
case 28:
ws2812fx.setMode(FX_MODE_TWINKLE_FADE_RANDOM);
break;
case 29:
ws2812fx.setMode(FX_MODE_SPARKLE);
break;
case 30:
ws2812fx.setMode(FX_MODE_FLASH_SPARKLE);
break;
case 31:
ws2812fx.setMode(FX_MODE_HYPER_SPARKLE);
break;
case 32:
ws2812fx.setMode(FX_MODE_STROBE);
break;
case 33:
ws2812fx.setMode(FX_MODE_STROBE_RAINBOW);
break;
case 34:
ws2812fx.setMode(FX_MODE_MULTI_STROBE);
break;
case 35:
ws2812fx.setMode(FX_MODE_BLINK_RAINBOW);
break;
case 36:
ws2812fx.setMode(FX_MODE_CHASE_WHITE);
break;
case 37:
ws2812fx.setMode(FX_MODE_CHASE_COLOR);
break;
case 38:
ws2812fx.setMode(FX_MODE_CHASE_RANDOM);
break;
case 39:
ws2812fx.setMode(FX_MODE_CHASE_FLASH);
break;
case 40:
ws2812fx.setMode(FX_MODE_CHASE_FLASH_RANDOM);
break;
case 41:
ws2812fx.setMode(FX_MODE_CHASE_RAINBOW_WHITE);
break;
case 42:
ws2812fx.setMode(FX_MODE_CHASE_BLACKOUT);
break;
case 43:
ws2812fx.setMode(FX_MODE_COLOR_SWEEP_RANDOM);
break;
case 44:
ws2812fx.setMode(FX_MODE_RUNNING_COLOR);
break;
case 45:
ws2812fx.setMode(FX_MODE_RUNNING_RED_BLUE);
break;
case 46:
ws2812fx.setMode(FX_MODE_LARSON_SCANNER);
break;
case 47:
ws2812fx.setMode(FX_MODE_COMET);
break;
case 48:
ws2812fx.setMode(FX_MODE_FIREWORKS);
break;
case 49:
ws2812fx.setMode(FX_MODE_FIREWORKS_RANDOM);
break;
case 50:
ws2812fx.setMode(FX_MODE_FIRE_FLICKER);
break;
case 51:
ws2812fx.setMode(FX_MODE_FIRE_FLICKER_SOFT);
break;
case 52:
ws2812fx.setMode(FX_MODE_FIRE_FLICKER_INTENSE);
break;
case 53:
ws2812fx.setMode(FX_MODE_CIRCUS_COMBUSTUS);
break;
case 54:
ws2812fx.setMode(FX_MODE_BICOLOR_CHASE);
break;
case 55:
ws2812fx.setMode(FX_MODE_TRICOLOR_CHASE);
break;
case 56:
ws2812fx.setMode(FX_MODE_ICU);
break;
default:
break;
}
}
if (topic == "LED/green")
{
g = noidung.toInt();
setcolor();
}
if (topic == "LED/red")
{
r = noidung.toInt();
setcolor();
}
if (topic == "LED/blue")
{
b = noidung.toInt();
setcolor();
}
if (topic == "DEN/room1")
{
if (noidung == "1") {
Serial.println("ON");
digitalWrite(Den_Pin1, LOW); // LED có sẵn trên NodeMCU bật ở mức 0(LOW)
State1 = HIGH;
}
// Tắt LED nếu nhận được lệnh là 0
if (noidung == "0") {
Serial.println("OFF");
digitalWrite(Den_Pin1, HIGH); // LED tắt ở mức 1(HIGH)
State1 = LOW;
}
}
if (topic == "DEN/room2")
{
if (noidung == "1") {
digitalWrite(Den_Pin2, LOW);
State2 = HIGH;
}
if (noidung == "0") {
digitalWrite(Den_Pin2, HIGH);
State2 = LOW;
}
}
}
void setcolor()
{
ws2812fx.setColor(g, r, b);
}
void checkbutton(void)
{
if (digitalRead(Button1) == HIGH && State1 == LOW)
{
den1status = LOW;
digitalWrite(Den_Pin1, den1status);
State1 = HIGH;
client.publish("DEN/room1", String(!digitalRead(Den_Pin1)).c_str());
while (digitalRead(Button1) == HIGH)
{
yield();
}
}
if (digitalRead(Button2) == HIGH && State2 == LOW)
{
den2status = LOW;
digitalWrite(Den_Pin2, den2status);
State2 = HIGH;
client.publish("DENn/room2", String(!digitalRead(Den_Pin2)).c_str());
while (digitalRead(Button2) == HIGH)
{
yield();
}
}
if (digitalRead(Button1) == HIGH && State1 == HIGH)
{
den1status = HIGH;
digitalWrite(Den_Pin1, den1status);
State1 = LOW;
client.publish("DEN/room1", String(!digitalRead(Den_Pin1)).c_str());
while (digitalRead(Button1) == HIGH)
{
yield();
}
}
if (digitalRead(Button2) == HIGH && State2 == HIGH)
{
den2status = HIGH;
digitalWrite(Den_Pin2, den2status);
State2 = LOW;
client.publish("DEN/room2", String(!digitalRead(Den_Pin2)).c_str());
while (digitalRead(Button2) == HIGH)
{
yield();
}
}
}
void setup() {
int timeoutcounter = 0;
Serial.begin(115200);
dht.begin();
WiFi.begin(ssid, password);
pinMode(LEDPIN, OUTPUT);
ws2812fx.init();
ws2812fx.setBrightness(255);
ws2812fx.setSpeed(SPEED);
ws2812fx.setColor(0xFF5900);
ws2812fx.setMode(FX_MODE_STATIC);
ws2812fx.start();
pinMode(Den_Pin1, OUTPUT); pinMode(Den_Pin2, OUTPUT);
pinMode(Button1, INPUT); pinMode(Button2, INPUT);
digitalWrite(Den_Pin1, den1status); digitalWrite(Den_Pin2, den2status);
while (WiFi.status() != WL_CONNECTED) {
timeoutcounter++;
delay(500);
if (timeoutcounter >= 30) {
if (debug) {
Serial.println("Failed to connect to wireless - sleeping for 5 minutes");
delay(5000);
}
}
}
client.setServer(mqtt_server, 1883);
client.setCallback(nhand1);
ArduinoOTA.setPassword((const char *)"123");
ArduinoOTA.onStart( {
Serial.println("Start");
});
ArduinoOTA.onEnd( {
Serial.println("\nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.begin();
Serial.println("Ready");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
}
void reconnect() {
while (!client.connected()) {
if (client.connect("ESP8266Clientroom")) {
client.publish("arduino_2_data", "OnLine");
client.subscribe("LED/dk");
client.subscribe("LED/green");
client.subscribe("LED/red");
client.subscribe("LED/blue");
client.subscribe("DEN/room1");
client.subscribe("DEN/room2");
} else {
if (debug) {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
}
delay(5000);
}
}
}
void loop()
{
ws2812fx.service();
client.loop();
ArduinoOTA.handle();
if (!client.connected()) {
reconnect();
}
if (millis() - lastMillis > 100) {
checkbutton();
lastMillis = millis();
}
unsigned long now = millis();
if (now - lastMeasure > 30000) {
tempandhump();
lastMeasure = now;
}
}
void tempandhump(void)
{
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
float f = dht.readTemperature(true);
// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println("Fall to read sensor");
return;
}
float hic = dht.computeHeatIndex(t, h, false);
static char temperatureTemp[7];
dtostrf(hic, 6, 2, temperatureTemp);
static char humidityTemp[7];
dtostrf(h, 6, 2, humidityTemp);
client.publish("Mainroom/Temp", temperatureTemp);
client.publish("Mainroom/Hum", humidityTemp);
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %\t Temperature: ");
Serial.print(t);
Serial.print(" *C ");
Serial.print(f);
Serial.print(" *F\t Heat index: ");
Serial.print(hic);
Serial.println(" *C ");
delay(50);
}
I use arduino nano with a strip ws2812b and use "serial_control". And when the power goes out, the settings are reset to the default values. How I can use EEPROM for store settings and use it for control?
Using this code,
#include <WS2812FX.h>
#define LED_COUNT 4
#define LED_PIN 2
WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
ws2812fx.init();
ws2812fx.setColor(255, 69, 3);
ws2812fx.setBrightness(100);
ws2812fx.setSpeed(70);
ws2812fx.setMode(46);
ws2812fx.start();
}
void loop() {
ws2812fx.service();
}
The lights seem to stay default green although they do flash briefly for a second. Am I doing this wrong to change the color?
Hello,
I try to use your Library, but with Arduino 1.6.13,
and with Arduino : 1.6.5 (Windows 10), Carte : "Arduino Uno".
IDE arduino replies in compilation:
"In file included from test-effets-neopixels-fx.ino:3:0:
C:\Users\jean-louis\Documents\1-ROBOTIQUE...techno\1-ARDUINO\2-DOSSIER des sketchs\libraries\WS2812FX/WS2812FX.h:123:37: error: 'neoPixelType' has not been declared
WS2812FX(uint16_t n, uint8_t p, neoPixelType t) : Adafruit_NeoPixel(n, p, t) {
^
Erreur lors de la compilation."
Perhaps, it is in this line of file " .........h" ??
class WS2812FX : public Adafruit_NeoPixel { typedef void (WS2812FX::*mode_ptr)(void);
public:
WS2812FX(uint16_t n, uint8_t p, neoPixelType t) : Adafruit_NeoPixel(n, p, t) {
thanks for your help
(Excuse my english language, it's very bad!)
papybricol
You have a very good project, I'm really looking forward to new effects
Im trying to use this library on an ESP-01 but when trying to flash the webinterface example i get the following error, any idea whats going on?
also tried going back to a older version of the esp8266 arduino core thingy but didnt make a difference.
Arduino: 1.8.1 (Windows 10), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"
In file included from C:\Users\Tom\AppData\Local\Temp\arduino_modified_sketch_658435\esp8266_webinterface.ino:46:0:
main.js.h:1: error: main_js causes a section type conflict with __c
const char main_js[] PROGMEM = R"=====(
^
In file included from C:\Users\Tom\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc1\cores\esp8266/Arduino.h:243:0,
from C:\Users\Tom\AppData\Local\Temp\arduino_build_937800\sketch\esp8266_webinterface.ino.cpp:1:
C:\Users\Tom\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc1\cores\esp8266/pgmspace.h:21:51: note: '__c' was declared here
#define PSTR(s) (extension({static const char __c[] PROGMEM = (s); &__c[0];}))
^
C:\Users\Tom\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc1\cores\esp8266/WString.h:38:76: note: in definition of macro 'FPSTR'
#define FPSTR(pstr_pointer) (reinterpret_cast<const __FlashStringHelper *>(pstr_pointer))
^
C:\Users\Tom\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc1\cores\esp8266/WString.h:39:34: note: in expansion of macro 'PSTR'
#define F(string_literal) (FPSTR(PSTR(string_literal)))
^
C:\Program Files (x86)\Arduino\libraries\WS2812FX-master/WS2812FX.h:227:50: note: in expansion of macro 'F'
_name[FX_MODE_HALLOWEEN] = F("Halloween"); ^
Bibliothek ESP8266WiFi in Version 1.0 im Ordner: C:\Users\Tom\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc1\libraries\ESP8266WiFi wird verwendet
Bibliothek ESP8266WebServer in Version 1.0 im Ordner: C:\Users\Tom\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.0-rc1\libraries\ESP8266WebServer wird verwendet
Bibliothek WS2812FX-master im Ordner: C:\Program Files (x86)\Arduino\libraries\WS2812FX-master (legacy) wird verwendet
Bibliothek Adafruit_NeoPixel in Version 1.1.2 im Ordner: C:\Users\Tom\Documents\Arduino\libraries\Adafruit_NeoPixel wird verwendet
exit status 1
main_js causes a section type conflict with __c
Hello,
How is it possible to remove effects simply?
I use "auto_mode_cycle" which is perfect for my use but there are some effects that I would not use.
Thank you for sharing
bye
Please check out the development branch and try it. Your feedback is welcome.
Please add general feedback here and feel free to open new issues on errors.
Thanks for your support!
Board: ESP-01S (1MB)
platformIO is used for compilation
What modes require:
Speed
Color
Brightness
to function.
When adding It doesn't power any lights on at all. Should I be calling modes by number or by name?:
//FX_MODE_STROBE "Alexa, turn strobe lights on"
if ( (strcmp(device_name, "strobe lights") == 0) ) {
if (state) {
neopixel_state = true;
ws2812fx.setBrightness(BRI);
ws2812fx.setSpeed(200);
ws2812fx.setMode(26);
} else {
neopixel_state = false;
ws2812fx.setBrightness(0);
ws2812fx.setMode(0);
}
}
Hello my name is Niko
first of all thanks for sharing these information with all of us.
My request is about handling patterns in a way that can be called when a message is received.
below is an implementation that i want to achieve with nrf24.
receiver side:
#include "nRF24L01.h"
#include "RF24.h"
#include "SPI.h"
int ReceivedMessage[1] = {000};
RF24 radio(9,10);
const uint64_t pipe = 0xE6E6E6E6E6E6;
void setup(void){
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
}
void loop(){
while (radio.available())
{
radio.read(ReceivedMessage, 1);
if (ReceivedMessage[0] == 1)
{do something}
if (ReceivedMessage[0] == 2)
{do something}
if (ReceivedMessage[0] == 3)
{do something}
if (ReceivedMessage[0] == 4)
{do something}
}
(run the pattern);
}
the receiver node will get these messages every 5 seconds.
So every pattern will be active for 5 seconds with its own parameters(speed and color)
in this way i can put 30 nodes which will perfectly synchronized.
If i put all nodes with one start message after a while they will not be together because of timing difference of each arduino.
And of course all these patterns need to be delay free as your library does!
thanks for reading this.
Best regards
Niko
First, thank you for putting this library together. I'm trying to use it with an Adafruit tutorial for an Alexa controlled WS2812 device.
I'm going to create FauxWemo devices using the fauxmoESP library and assigning them to specific effects in your library. That way I can just have Alexa turn on/off the different effects easily.
The FauxWemo + Alexa stuff is working fine however when I try and ws2812fx.setMode(40);
or any other animated effect it doesn't animate, it just sits there static. Any help would be appreciated.
Here is the code:
#include <Arduino.h>
#include <Adafruit_NeoPixel.h>
#include <ESP8266WiFi.h>
#include "fauxmoESP.h"
#include <WS2812FX.h>
#define WIFI_SSID ""
#define WIFI_PASS ""
#define SERIAL_BAUDRATE 115200
fauxmoESP fauxmo;
#define LED_COUNT 12
#define LED_PIN 2
WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRBW + NEO_KHZ800);
volatile boolean neopixel_state = false; // off by default!
// -----------------------------------------------------------------------------
// Wifi
// -----------------------------------------------------------------------------
void wifiSetup() {
// Set WIFI module to STA mode
WiFi.mode(WIFI_STA);
// Connect
Serial.printf("[WIFI] Connecting to %s ", WIFI_SSID);
WiFi.begin(WIFI_SSID, WIFI_PASS);
// Wait
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(100);
}
Serial.println();
// Connected!
Serial.printf("[WIFI] STATION Mode, SSID: %s, IP address: %s\n", WiFi.SSID().c_str(), WiFi.localIP().toString().c_str());
}
void callback(uint8_t device_id, const char * device_name, bool state) {
Serial.printf("[MAIN] %s state: %s\n", device_name, state ? "ON" : "OFF");
if ( (strcmp(device_name, "rainbow") == 0) ) {
// this just sets a variable that the main loop() does something about
if (state) {
neopixel_state = true;
} else {
neopixel_state = false;
}
}
}
void setup() {
// Init WS2812FX
ws2812fx.init();
// Init serial port and clean garbage
Serial.begin(SERIAL_BAUDRATE);
Serial.println();
Serial.println();
Serial.println("FauxMo demo sketch");
Serial.println("After connection, ask Alexa/Echo to 'turn pixels on' or 'off' or 'turn relay on' or 'off'");
// Wifi
wifiSetup();
// Fauxmo
fauxmo.addDevice("rainbow");
fauxmo.onMessage(callback);
}
void loop() {
fauxmo.handle();
ws2812fx.service();
if (neopixel_state == true) {
ws2812fx.setBrightness(100);
ws2812fx.setSpeed(200);
ws2812fx.setMode(40);
ws2812fx.start();
} else {
ws2812fx.stop();
}
}
For "music visualisation"/ "spectrum analyzer" effects, the MSGEQ7 is a great chip, there are quite a few examples on youtube. It would make your library more complete if you would support it.
Hi! First off, love this library! Just one problem I'm finding. I'm trying to control 288 LEDs, and this library seems to max out at 235. I have 2 x 1 meter strips with 144 LEDs each chained in my front window. Unfortunately, I'm not getting any use out of those last 53 lights. Other libraries like FastLED and Adafruit Neopixel seem to work just fine, but I really love the FX in this library. The strips are WS2812B running off an Arduino Uno R3. Should it be possible to control all 288? If so, any ideas on what I might try to get this library to work with all my lights? If not, just curious why and if there's a chance the limit could be raised. Thank you very much for the hard work on this!
Thank you for this wonderful library and examples. I use an example from the web server on esp. it's great.
but in the chrome browser on smartphones color scale it is not working properly.
shade similar, but very few colors.
on the PC everything is fine.
maybe you can help.
Hello, the Adafruit library supports RGBW LEDs but I get odd results because i cannot use the NEO_GRBW constant with your library. Should this already be supported? Or do you still have to implement it to catch up the the Adafruit library? Thanks! Your library is awesome, btw.
As a preface, I don't have much experience with coding, and in WAY over my head with this LED programing. But I've gotten the web interface up and running, so I feel fairly accomplished already.
But how would I add a button to the web interface that would allow me to cycle through multiple effects in sequence, say for 60 seconds each. I would like to pick the effects that are included, not just all of them.
I'm also wondering how I could remove some of the effect I don't plan on using from the web interface.
Thanks in advance for the help!
I own some WS2801 and would like to control them using this awesome library.
What would be the preferred method?
Adafruit_NeoPixel
to Adafruit-WS2801-Library
in a fork (then being named WS2801FX)Would the maintainer accept a PR that implemented 1.?
If yes, I would work on this, if not, I would attempt 2.
Using my Arduino Micro to control my WS2812b ring and the sketch size is just too big for it so I added #define REDUCED_MODES thinking it can shrink the sketch size, but before and after adding it, the sketch size does not shrink but remain the same size. Also I only want a certain effects, can I add more effects I wish to be replaced with STATIC into the library?
Hi,
I try to compile examples from WS2812FX, but i can't because some comping errors i get.
I am using Arduino IDE 1.8.5. All library is up to date.
Error log:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp: In member function 'void WS2812FX::service()':
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: error: no matching function for call to 'max(uint16_t&, int)'
SEGMENT_RUNTIME.next_time = now + max(delay, SPEED_MIN);
^
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: note: candidates are:
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:62:0,
from C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\cores\esp8266/Arduino.h:240,
from C:\Users\devuser\Documents\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:23,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.h:40,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:54:
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4236:5: note: template<class _Tp, class _Compare> _Tp std::max(std::initializer_list<_Tp>, _Compare)
max(initializer_list<_Tp> __l, _Compare __comp)
^
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4236:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: note: mismatched types 'std::initializer_list<_Tp>' and 'short unsigned int'
SEGMENT_RUNTIME.next_time = now + max(delay, SPEED_MIN);
^
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:62:0,
from C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\cores\esp8266/Arduino.h:240,
from C:\Users\devuser\Documents\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:23,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.h:40,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:54:
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4231:5: note: template _Tp std::max(std::initializer_list<_Tp>)
max(initializer_list<_Tp> __l)
^
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4231:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: note: mismatched types 'std::initializer_list<_Tp>' and 'short unsigned int'
SEGMENT_RUNTIME.next_time = now + max(delay, SPEED_MIN);
^
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:61:0,
from C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\cores\esp8266/Arduino.h:240,
from C:\Users\devuser\Documents\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:23,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.h:40,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:54:
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:260:5: note: template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:260:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: note: deduced conflicting types for parameter 'const _Tp' ('short unsigned int' and 'int')
SEGMENT_RUNTIME.next_time = now + max(delay, SPEED_MIN);
^
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:61:0,
from C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\cores\esp8266/Arduino.h:240,
from C:\Users\devuser\Documents\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:23,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.h:40,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:54:
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:216:5: note: template const _Tp& std::max(const _Tp&, const _Tp&)
max(const _Tp& __a, const _Tp& __b)
^
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:216:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:72:63: note: deduced conflicting types for parameter 'const _Tp' ('short unsigned int' and 'int')
SEGMENT_RUNTIME.next_time = now + max(delay, SPEED_MIN);
^
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp: In member function 'uint16_t WS2812FX::mode_fade()':
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: error: no matching function for call to 'min(int, uint8_t&)'
b = map(b, 0, 64, min(25, _brightness), _brightness);
^
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: note: candidates are:
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:62:0,
from C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\cores\esp8266/Arduino.h:240,
from C:\Users\devuser\Documents\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:23,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.h:40,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:54:
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4226:5: note: template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)
min(initializer_list<_Tp> __l, _Compare __comp)
^
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4226:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
b = map(b, 0, 64, min(25, _brightness), _brightness);
^
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:62:0,
from C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\cores\esp8266/Arduino.h:240,
from C:\Users\devuser\Documents\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:23,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.h:40,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:54:
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4221:5: note: template _Tp std::min(std::initializer_list<_Tp>)
min(initializer_list<_Tp> __l)
^
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algo.h:4221:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
b = map(b, 0, 64, min(25, _brightness), _brightness);
^
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:61:0,
from C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\cores\esp8266/Arduino.h:240,
from C:\Users\devuser\Documents\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:23,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.h:40,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:54:
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:239:5: note: template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:239:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'uint8_t {aka unsigned char}')
b = map(b, 0, 64, min(25, _brightness), _brightness);
^
In file included from C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\algorithm:61:0,
from C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\cores\esp8266/Arduino.h:240,
from C:\Users\devuser\Documents\Arduino\libraries\Adafruit_NeoPixel/Adafruit_NeoPixel.h:23,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.h:40,
from C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:54:
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:193:5: note: template const _Tp& std::min(const _Tp&, const _Tp&)
min(const _Tp& __a, const _Tp& __b)
^
C:\Users\devuser\documents\arduino\hardware\espressif\esp8266\tools\xtensa-lx106-elf\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_algobase.h:193:5: note: template argument deduction/substitution failed:
C:\Users\devuser\Documents\Arduino\libraries\WS2812FX\WS2812FX.cpp:529:40: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'uint8_t {aka unsigned char}')
b = map(b, 0, 64, min(25, _brightness), _brightness);
^
Using library WS2812FX in folder: C:\Users\devuser\Documents\Arduino\libraries\WS2812FX (legacy)
Using library Adafruit_NeoPixel at version 1.1.3 in folder: C:\Users\devuser\Documents\Arduino\libraries\Adafruit_NeoPixel
Using library ESP8266WebServer at version 1.0 in folder: C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\libraries\ESP8266WebServer
Using library ESP8266WiFi at version 1.0 in folder: C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\libraries\ESP8266WiFi
Using library ArduinoJson at version 5.11.2 in folder: C:\Users\devuser\Documents\Arduino\libraries\ArduinoJson
Using library ArduinoOTA at version 1.0 in folder: C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\libraries\ArduinoOTA
Using library ESP8266mDNS in folder: C:\Users\devuser\Documents\Arduino\hardware\espressif\esp8266\libraries\ESP8266mDNS (legacy)
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).
If you need another information just write to me :)
Thanks in advance!
The current two fire effects seem to be only based on the current color, but don't do any color variations that are typical for real flickering fire.
It would be nice, if another fire effect would be added which looks more like this one.
New in arduino programming,always gor this error:
`In file included from sketch\WS2812FX.cpp:54:0:
WS2812FX.h:324: error: '__FlashStringHelper' does not name a type
const __FlashStringHelper*
^
WS2812FX.h:425: error: '__FlashStringHelper' does not name a type
const __FlashStringHelper*
^
In file included from sketch\WS2812FX.cpp:54:0:
sketch\WS2812FX.h: In constructor 'WS2812FX::WS2812FX(uint16_t, uint8_t, neoPixelType)':
WS2812FX.h:206: error: '_name' was not declared in this scope
_name[FX_MODE_STATIC] = F("Static");
^
sketch\WS2812FX.cpp: At global scope:
WS2812FX.cpp:222: error: '__FlashStringHelper' does not name a type
const __FlashStringHelper* WS2812FX::getModeName(uint8_t m) {
^
exit status 1
'__FlashStringHelper' does not name a type`
Hi, I have a problem, because I have a strip with 492 WS2812B leds , and unfortunately I can't use whole of these leds with this library. Everything works with 304 leds or lower. When I'm trying to declare more than 304 leds my stripe is not showing anything.
`#include <WS2812FX.h>
#define LED_COUNT 492
#define LED_PIN 7
WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
ws2812fx.init();
ws2812fx.setBrightness(100);
ws2812fx.setSpeed(200);
ws2812fx.setMode(FX_MODE_RAINBOW_CYCLE);
ws2812fx.start();
}
void loop() {
ws2812fx.service();
}`
How can I fix this and how can I use thi library with my long stripe?
I'm looking forward to your answear.
Same as christmas but with purple and orange!
255,0,130 and 255,50,0
thanks
Hello,
I'm using esp8266_webinterface sketch and i'd like to control it with http request like: "http://ip_of_wemos/set?b=255" to set brightness to 255.
Is it possible ?
Regards,
It looks like platform.io library for ws2812fx is invalid, there's a subfolder and the .h
file isn't in the path unless moved by hand to the right location.
I am working on a project that uses a push button to cycle through different lighting sequences. My question is how can I take and select only the functions I want? I would like to then modify colors, timings, etc. I am sorry for the lack of knowledge, but any help would be very much appreciated.
Okay, since the title is limited, let me explain the virtual strips part.
Say you have a few various shaped "strips", "bits", "rings", etc. made of one or more WS2812 LEDs. Say you want to control them all, but from a single pin (because your project includes more and more devices that an ESP8266 or an Arduino can support).
So it would be nice to be able to define a single strip (say, 3x 24-LED rings in series, first one connected to a pin, second one connected to first one's output, et cetera), and be able to make segments out of it, animated separately. I'm thinking something similar to this:
#include <WS2812FX.h>
#define LED_COUNT 72
#define LED_PIN 15
WS2812FX strip= WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
WS2812FXSegment segment1 = strip.segment(0 ,23);
WS2812FXSegment segment2 = strip.segment(24, 47);
WS2812FXSegment segment3 = strip.segment(48, 71)
void setup() {
strip.init();
strip.setBrightness(255); // Modifying the strip object will modify all segments too
strip.setSpeed(100);
strip.setMode(FX_MODE_FLASH_SPARKLE);
segment2.setMode(FX_MODE_RAINBOW_CYCLE); // setting the segment options after the strip will override those settings for said segment
segment2.setSpeed(150);
strip.start(); // starting the strip should go over all defined segments and start them separately
}
void loop() {
strip.service(); // servicing the strip should go over all defined segments and service them too
}
And about the direction of animations. Especially on rings, alignment is a bitch. Say you want two 24-LED rings do the same animation, and attach them back to back. Well you can't, since the directions won't match. So it would be nice if separate WS2812FX objects (and, if implemented, segments too) could have a direction set (either NORMAL, which means the current direction and addressing 0..n
, and REVERSE, which means reversed direction addressing n..0
).
Hi!
look like speed calculation wrong (IMHO)
can you change speed calculation like this:
//SEGMENT_RUNTIME.next_time = now + max(delay, 20);
SEGMENT_RUNTIME.next_time = now + map(delay, 0, 255, 20, 1000);
Thank you!
Hi, firstly I am new here! So please be patient.
Using sample code sketch on a 144LED Strip - http://www.banggood.com/5V-WS2812B-43W-144-SMD-5050-RGB-LED-Strip-Waterproof-IP65-Individual-Addressable-p-1042712.html and only 19 of the LED's are being used.
Tried the Adafruit NeoPixel Library and made no difference?
Any suggestions?
#define LED_COUNT 144
#define LED_PIN 11
WS2812FX ws2812fx = WS2812FX(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
Since this would be geared at the IOT space it would probably make sense to support directly the MQTT protocol for setting up the lights and animations? Or at least if there was an example available for us noobs out there :D.
Hi,
I had a arduino ATMega328P code compiling with this library (SHA 069139b). Code size was 29948 bytes. If I compile same code with latest, code size blows to 38694 bytes.
The newer commits added about 8KB of code, this represents 1/3 of available code memory for an regular Arduino.
I lack the three functions in your library.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.