Hello. I'm fairly new to Arduino Cloud, but have had some success with ESP8266 NodeMCU and ESP32 Development Boards. I use Cloud because I want Alexa integration. Having difficulty with an ESP8266 and my WS8212 LEDs. Trying to use fastled,h which works on my Arduino IDE desktop, but blows up on the Cloud interface. Any guidance would be appreciated.
Hi @jddent9822. Please add a forum reply here that provides a detailed explanation of what you mean by this, including:
- What did you do?
- What were the results you expected from doing that thing?
- What were the results you observed that did not match your expectations?
Make sure to include the full and exact text of any error or warning messages you might have encountered.
Hello @ptillisch, Thank You for responding to my issue. I hope I am requesting help in the proper manner.
I am using an ESP8266 NodeMCU 1 12E and WS8212 LEDs
The following code is my basic sketch. Comments within should explain.
After commenting out all of the Arduino Cloud generated code this sketch compiles in my Arduino IDE on my desktop with only a warning from the library that SPI pins were not defined and would be bitbanged etc. It loads into my ESP and runs perfectly.
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/7d3b42b7-5324-49ab-a02d-e027c2c69f80
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
CloudSwitch alcove_Lights;
CloudSwitch Christmas_Time;
CloudSwitch easter;
CloudSwitch halloween;
CloudSwitch patriotic_Days;
CloudSwitch saint_Patricks_Day;
CloudSwitch thanksgiving;
CloudSwitch valentines_Day;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
// My Include and Define Additions
#include <FastLED.h>
#define DATA_PIN D3
#define NUM_LEDS 10
#define COLOR_ORDER GRB
CRGB leds[NUM_LEDS];
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
// My setup Additions
FastLED.addLeds<WS2812, DATA_PIN, GRB>(leds, NUM_LEDS);
}
void loop() {
ArduinoCloud.update();
// Your code here
// The following are my loop Additions
// Only Christmas has been uncomented so the loop only executes Christmas()
// Later I will add logic to call other "holidays" based on Alexa commands to "switches" boolean.
// ValentinesDay();
// PatrioticDays();
Christmas();
// Saint_Patricks_Day();
// Easter();
// Thanksgiving;
// Halloween();
}
// The following is my only Holiday LED Routine
// Once the sketch compiles correctly I will add more holiday routines and logic
void Christmas(){
// The following fades the LED Strip from Red to Green each fading through Black..
for( int colorStep=0; colorStep<256; colorStep++ ) { // Let's take 256 steps to get from Black to Green
int r = 0; // Red value stays at 0
int b = 0; // Blue value always at zero
int g = colorStep; // Green value starts at zero and goes to full
// Now loop through each of the LEDs and set each one to the current color
for(int x = 0; x < NUM_LEDS; x++){
leds[x] = CRGB(r,g,b);
}
FastLED.show(); // Display the colors we just set on the actual LEDs
delay(10);
}
delay(4000);
for( int colorStep=255; 0<colorStep; colorStep-- ) { // Let's take 256 steps to get from Green to Black
int r = 0; // Red value stays at 0
int b = 0; // Blue value always at zero
int g = colorStep; // Green value starts at full and diminishes to zero
// Now loop through each of the LEDs and set each one to the current color
for(int x = 0; x < NUM_LEDS; x++){
leds[x] = CRGB(r,g,b);
}
FastLED.show(); // Display the colors we just set on the actual LEDs
delay(10);
}
for( int colorStep=0; colorStep<256; colorStep++ ) { // Let's take 256 steps to get from Black to Red
int r = colorStep; // Red value starts at 0 and goes to full
int b = 0; // Blue value always at zero
int g = 0; // Green value stays at zero
// Now loop through each of the LEDs and set each one to the current color
for(int x = 0; x < NUM_LEDS; x++){
leds[x] = CRGB(r,g,b);
}
FastLED.show(); // Display the colors we just set on the actual LEDs
delay(10);
}
delay(4000);
for( int colorStep=255; 0<colorStep; colorStep-- ) { // Let's take 256 steps to get from Red to Black
int r = colorStep; // Red value stays at 0
int b = 0; // Blue value always at zero
int g = 0; // Green value stays at zero
// Now loop through each of the LEDs and set each one to the current color
for(int x = 0; x < NUM_LEDS; x++){
leds[x] = CRGB(r,g,b);
}
FastLED.show(); // Display the colors we just set on the actual LEDs
delay(10);
}
}
/*
Since AlcoveLights is READ_WRITE variable, onAlcoveLightsChange() is
executed every time a new value is received from IoT Cloud.
*/
void onAlcoveLightsChange() {
// Add your code here to act upon AlcoveLights change
}
/*
Since ChristmasTime is READ_WRITE variable, onChristmasTimeChange() is
executed every time a new value is received from IoT Cloud.
*/
void onChristmasTimeChange() {
// Add your code here to act upon ChristmasTime change
}
/*
Since SaintPatricksDay is READ_WRITE variable, onSaintPatricksDayChange() is
executed every time a new value is received from IoT Cloud.
*/
void onSaintPatricksDayChange() {
// Add your code here to act upon SaintPatricksDay change
}
/*
Since PatrioticDays is READ_WRITE variable, onPatrioticDaysChange() is
executed every time a new value is received from IoT Cloud.
*/
void onPatrioticDaysChange() {
// Add your code here to act upon PatrioticDays change
}
/*
Since Halloween is READ_WRITE variable, onHalloweenChange() is
executed every time a new value is received from IoT Cloud.
*/
void onHalloweenChange() {
// Add your code here to act upon Halloween change
}
/*
Since ValentinesDay is READ_WRITE variable, onValentinesDayChange() is
executed every time a new value is received from IoT Cloud.
*/
void onValentinesDayChange() {
// Add your code here to act upon ValentinesDay change
}
/*
Since Easter is READ_WRITE variable, onEasterChange() is
executed every time a new value is received from IoT Cloud.
*/
void onEasterChange() {
// Add your code here to act upon Easter change
}
/*
Since Thanksgiving is READ_WRITE variable, onThanksgivingChange() is
executed every time a new value is received from IoT Cloud.
*/
void onThanksgivingChange() {
// Add your code here to act upon Thanksgiving change
}
When I try to verify online within the Arduino Cloud Environment it generates the following Errors.
Start verifying
In file included from /home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/fastled_esp8266.h:9:0,
from /home/builder/Arduino/libraries/fastled_3_6_0/src/platforms.h:40,
from /home/builder/Arduino/libraries/fastled_3_6_0/src/FastLED.h:62,
from /tmp/2974050817/Alcove_Lights_West_feb19a/Alcove_Lights_West_feb19a.ino:28:
/home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/clockless_esp8266.h:85:18: error: expected ';' at end of member declaration
static uint32_t IRAM_ATTR showRGBInternal(PixelController<RGB_ORDER> pixels) {
^
/home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/clockless_esp8266.h:85:77: error: ISO C++ forbids declaration of 'showRGBInternal' with no type [-fpermissive]
static uint32_t IRAM_ATTR showRGBInternal(PixelController<RGB_ORDER> pixels) {
^
In file included from /home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/fastled_esp8266.h:10:0,
from /home/builder/Arduino/libraries/fastled_3_6_0/src/platforms.h:40,
from /home/builder/Arduino/libraries/fastled_3_6_0/src/FastLED.h:62,
from /tmp/2974050817/Alcove_Lights_West_feb19a/Alcove_Lights_West_feb19a.ino:28:
/home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/clockless_block_esp8266.h:111:18: error: expected ';' at end of member declaration
static uint32_t IRAM_ATTR showRGBInternal(PixelController<RGB_ORDER, LANES, PORT_MASK> &allpixels) {
^
/home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/clockless_block_esp8266.h:111:99: error: ISO C++ forbids declaration of 'showRGBInternal' with no type [-fpermissive]
static uint32_t IRAM_ATTR showRGBInternal(PixelController<RGB_ORDER, LANES, PORT_MASK> &allpixels) {
^
In file included from /home/builder/Arduino/libraries/fastled_3_6_0/src/FastLED.h:75:0,
from /tmp/2974050817/Alcove_Lights_West_feb19a/Alcove_Lights_West_feb19a.ino:28:
/home/builder/Arduino/libraries/fastled_3_6_0/src/fastspi.h:157:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output
pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"
^
Error during build: exit status 1
In file included from /home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/fastled_esp8266.h:9:0,
from /home/builder/Arduino/libraries/fastled_3_6_0/src/platforms.h:40,
from /home/builder/Arduino/libraries/fastled_3_6_0/src/FastLED.h:62,
from /tmp/2974050817/Alcove_Lights_West_feb19a/Alcove_Lights_West_feb19a.ino:28:
/home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/clockless_esp8266.h:85:18: error: expected ';' at end of member declaration
static uint32_t IRAM_ATTR showRGBInternal(PixelController<RGB_ORDER> pixels) {
^
/home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/clockless_esp8266.h:85:77: error: ISO C++ forbids declaration of 'showRGBInternal' with no type [-fpermissive]
static uint32_t IRAM_ATTR showRGBInternal(PixelController<RGB_ORDER> pixels) {
^
In file included from /home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/fastled_esp8266.h:10:0,
from /home/builder/Arduino/libraries/fastled_3_6_0/src/platforms.h:40,
from /home/builder/Arduino/libraries/fastled_3_6_0/src/FastLED.h:62,
from /tmp/2974050817/Alcove_Lights_West_feb19a/Alcove_Lights_West_feb19a.ino:28:
/home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/clockless_block_esp8266.h:111:18: error: expected ';' at end of member declaration
static uint32_t IRAM_ATTR showRGBInternal(PixelController<RGB_ORDER, LANES, PORT_MASK> &allpixels) {
^
/home/builder/Arduino/libraries/fastled_3_6_0/src/platforms/esp/8266/clockless_block_esp8266.h:111:99: error: ISO C++ forbids declaration of 'showRGBInternal' with no type [-fpermissive]
static uint32_t IRAM_ATTR showRGBInternal(PixelController<RGB_ORDER, LANES, PORT_MASK> &allpixels) {
^
In file included from /home/builder/Arduino/libraries/fastled_3_6_0/src/FastLED.h:75:0,
from /tmp/2974050817/Alcove_Lights_West_feb19a/Alcove_Lights_West_feb19a.ino:28:
/home/builder/Arduino/libraries/fastled_3_6_0/src/fastspi.h:157:23: note: #pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output
pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"
^
Error during build: exit status 1
OK, great. That makes the problem clear. A very outdated version of the 3rd party "esp8266" boards platform is installed in Arduino Cloud. The latest version of the "FastLED" library is not compatible with that version of the "esp8266" platform, which causes this compilation error.
Fortunately, the previous versions of the "FastLED" library are compatible, so the solution will be to configure your sketch to use the compatible version of the library. I'll provide instructions you can follow to do that:
- If you are not already, log in to your Arduino account:
https://login.arduino.cc/login - Click the following link to open the list of your Arduino Cloud Things in the web browser:
https://app.arduino.cc/things - Click the name of the Thing you are working on.
The "Setup" page for the Thing will open. - Select the "Sketch" tab at the top of the page.
The "Sketch" page for the Thing will open. - Click the "</> Open full editor" button on the toolbar.
The Thing sketch will open in Arduino Cloud Editor (AKA "full editor"). - Unrelated to the compilation error you encountered, there is currently a bug in the "new" Cloud Editor that causes it to be incompatible with the FastLED library. So you must use the "old" editor until that bug is fixed (I have reported it to the developers). If you see a notification at the bottom right of the page that says "New Cloud Editor is out, try it now!", then you are already using the "old" editor and all is well. Otherwise, perform the following instructions:
- Click the "Settings" icon at the bottom left corner of the page:
The "Settings" panel will open. - Click the "REVERT TO OLD EDITOR" link in the "Settings" panel.
The "old" Cloud Editor will open.
- Click the "Settings" icon at the bottom left corner of the page:
- From the menu on the left side of the Arduino Cloud Editor window, click "Libraries".
- Click the "LIBRARY MANAGER" button.
The "Favorite the Contributed libraries you use the most" dialog will open. - Type
fastled
in the "SEARCH LIBRARY" field. - Find the "FastLED" library in the search results.
- If the star to the right of the library is not already filled, click the star.
This will add the library to your "Favorites" in Arduino Cloud Editor. - Click the "DONE" button.
The "Favorite the Contributed libraries you use the most" dialog will close. - From the Libraries panel of the Arduino Cloud Editor window, click the "FAVORITES" tab.
- Find the "FastLED" library in the list of favorite libraries and hover the mouse pointer over its name.
An "INCLUDE ▼" button will appear to the right side of the library name. - Click the ▼ on the right side of the "INCLUDE ▼" button.
A menu will open. - Select "VERSION 3.5.0'" from the menu.
This configures the sketch to use that specific version of the library.
Now try compiling or uploading the sketch again. Hopefully this time there won't be any errors.
ⓘ The procedure above only set the library version for use by the sketch you had open in the editor. If you want to use the "FastLED" library with an ESP8266 board in other sketches, just repeat the instructions above while that sketch is open in the editor.
Please let me know if you have any questions or problems while following those instructions.
Hello @ptillisch , Thanks once again for your assistance. The procedure you suggested worked very well to a point. I was able to "roll back" the version of the fastLED library and the sketch compiled successfully. I was also able to flash the code into my esp8266 nodemcu and the upload reported successful. However, upon resetting, the board then appears to lock up and display its on-board LED. I can go back to my desktop IDE and reflash the board and everything works, but of course I have no Cloud features.
Any ideas?
Hold on @ptillisch I've got something working. I put a Serial.print("Test") statement in my loop and it's printing in the monitor at a rate that I would expect based on timing within the Christmas() routine.
I think I'm having problems with the timing of the data on the pin to the LEDs. Since I'm currently using a WS8212 LED strip there is no clock control. Can interrupts from all of the Cloud variable routines or the cloud updates interfere with my LED data?
Hey @ptillisch
Just wanted to say thanks for all of your help. I quit. I bought a couple of ESP32 Dev Boards for my project. Hooked them in and they work as expected. Just a couple of minor changes to my sketch. If I had a bunch of ESP8266s deployed I'd be upset, but for the money, why chase outdated hardware? Thanks again.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.