fastLED library not working on photon

#Here is code I’m using:

//================================================

#include "FastLED.h"

#define LED_COUNT 15
#define LED_PIN 12

struct CRGB leds[LED_COUNT];

//================================================

uint8_t hue = 32;
byte idex = 255;
byte meteorLength = 29;

void setup() {
  // sanity check delay - allows reprogramming if accidently blowing power w/leds
   	delay(2000);
  LEDS.addLeds<WS2812, LED_PIN, GRB>(leds, LED_COUNT);
  LEDS.setBrightness(200);
}

void loop(){
 meteorShower(); 
}

void meteorShower(){
  // slide all the pixels down one in the array
  memmove8( &leds[1], &leds[0], (LED_COUNT - 1) * 3 );
 
 // increment the meteor display frame
  idex++;

  // make sure we don't drift into space
  if ( idex > meteorLength ) {
    idex = 0;
    // cycle through hues in each successive meteor tail
    hue += 32;  
  }

  // this switch controls the actual meteor animation, i.e., what gets placed in the
  // first position and then subsequently gets moved down the strip by the memmove above
  switch ( idex ) {
  case 0:
    leds[0] = CRGB(200,200,200); 
    break;
  case 1:
    leds[0] = CHSV((hue - 20), 255, 210); 
    break;
  case 2:
    leds[0] = CHSV((hue - 22), 255, 180); 
    break;
  case 3:
    leds[0] = CHSV((hue - 23), 255, 150); 
    break;
  case 4:
    leds[0] = CHSV((hue - 24), 255, 110); 
    break;
  case 5:
    leds[0] = CHSV((hue - 25), 255, 90); 
    break;
  case 6:
    leds[0] = CHSV((hue - 26), 160, 60); 
    break;
  case 7:
    leds[0] = CHSV((hue - 27), 140, 40); 
    break;
  case 8:
    leds[0] = CHSV((hue - 28), 120, 20); 
    break;
  case 9:
    leds[0] = CHSV((hue - 29), 100, 20); 
    break;
  default:
    leds[0] = CRGB::Black; 
  }

  // show the blinky
  FastLED.show();  
  // control the animation speed/frame rate
  delay(30);
}

#Here is the error I get when verifying:

Processing  meteorshower.ino
Checking library FastLED...
Checking library FastLED2...
Checking library neopixel...
Installing library neopixel 0.0.13 to lib/neopixel ...
Library neopixel 0.0.13 installed.
Installing library FastLED2 3.1.8 to lib/FastLED2 ...
Library FastLED2 3.1.8 installed.
Installing library FastLED 3.1.5 to lib/FastLED ...
Library FastLED 3.1.5 installed.
make -C ../modules/photon/user-part all
make[1]: Entering directory '/firmware/modules/photon/user-part'
make -C ../../../user 
make[2]: Entering directory '/firmware/user'
Building cpp file: src/meteorshower.cpp
Invoking: ARM GCC CPP Compiler
mkdir -p ../build/target/user/platform-6-msrc/
arm-none-eabi-gcc -DSTM32_DEVICE -DSTM32F2XX -DPLATFORM_THREADING=1 -DPLATFORM_ID=6 -DPLATFORM_NAME=photon -DUSBD_VID_SPARK=0x2B04 -DUSBD_PID_DFU=0xD006 -DUSBD_PID_CDC=0xC006 -DSPARK_PLATFORM -g3 -gdwarf-2 -Os -mcpu=cortex-m3 -mthumb -DINCLUDE_PLATFORM=1 -DPRODUCT_ID=6 -DPRODUCT_FIRMWARE_VERSION=65535 -DUSE_STDPERIPH_DRIVER -DDFU_BUILD_ENABLE -DSYSTEM_VERSION_STRING=0.6.2 -DRELEASE_BUILD -I./inc -I../wiring/inc -I../system/inc -I../services/inc -I../communication/src -I../hal/inc -I../hal/shared -I../hal/src/photon -I../hal/src/stm32f2xx -I../hal/src/stm32 -I../hal/src/photon/api -I../platform/shared/inc -I../platform/MCU/STM32F2xx/STM32_USB_Host_Driver/inc -I../platform/MCU/STM32F2xx/STM32_StdPeriph_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_OTG_Driver/inc -I../platform/MCU/STM32F2xx/STM32_USB_Device_Driver/inc -I../platform/MCU/STM32F2xx/SPARK_Firmware_Driver/inc -I../platform/MCU/shared/STM32/inc -I../platform/MCU/STM32F2xx/CMSIS/Include -I../platform/MCU/STM32F2xx/CMSIS/Device/ST/Include -I../dynalib/inc -Isrc -I./libraries -Isrc -Isrc -Isrc -Isrc -Ilib/FastLED/src -Ilib/FastLED2/src -Ilib/neopixel/src -I. -MD -MP -MF ../build/target/user/platform-6-msrc/meteorshower.o.d -ffunction-sections -fdata-sections -Wall -Wno-switch -Wno-error=deprecated-declarations -fmessage-length=0 -fno-strict-aliasing -DSPARK=1 -DPARTICLE=1 -DSTART_DFU_FLASHER_SERIAL_SPEED=14400 -DSTART_YMODEM_FLASHER_SERIAL_SPEED=28800 -DSPARK_PLATFORM_NET=BCM9WCDUSI09 -fno-builtin-malloc -fno-builtin-free -fno-builtin-realloc  -DLOG_INCLUDE_SOURCE_INFO=1 -DPARTICLE_USER_MODULE -DUSE_THREADING=0 -DUSE_SPI=SPI -DUSE_CS=A2 -DUSE_SPI=SPI -DUSE_CS=A2 -DUSE_THREADING=0 -DUSER_FIRMWARE_IMAGE_SIZE=0x20000 -DUSER_FIRMWARE_IMAGE_LOCATION=0x80A0000 -DMODULAR_FIRMWARE=1 -DMODULE_VERSION=4 -DMODULE_FUNCTION=5 -DMODULE_INDEX=1 -DMODULE_DEPENDENCY=4,2,108 -D_WINSOCK_H -D_GNU_SOURCE -DLOG_MODULE_CATEGORY="\"app\""  -fno-exceptions -fno-rtti -fcheck-new -std=gnu++11 -c -o ../build/target/user/platform-6-msrc/meteorshower.o src/meteorshower.cpp
In file included from meteorshower.ino:15:0:
lib/FastLED/src/FastLED.h:12:2: warning: #warning FastLED version 3001000 (Not really a warning, just telling you here.) [-Wcpp]
 #warning FastLED version 3001000  (Not really a warning, just telling you here.)
  ^
meteorshower.ino:5:27: error: elements of array 'CRGB leds [15]' have incomplete type
meteorshower.ino:5:27: error: storage size of 'leds' isn't known
In file included from meteorshower.ino:15:0:
meteorshower.ino: In function 'void setup()':
lib/FastLED/src/FastLED.h:457:14: error: 'FastLED' was not declared in this scope
 #define LEDS FastLED
              ^
meteorshower.ino:25:3: note: in expansion of macro 'LEDS'
lib/FastLED/src/FastLED.h:457:14: note: suggested alternative:
 #define LEDS FastLED
              ^
meteorshower.ino:25:3: note: in expansion of macro 'LEDS'
lib/FastLED/src/FastLED.h:460:17: note:   'NSFastLED::FastLED'
 extern CFastLED FastLED;
                 ^
meteorshower.ino:25:16: error: 'WS2812' was not declared in this scope
meteorshower.ino:25:16: note: suggested alternative:
In file included from meteorshower.ino:15:0:
lib/FastLED/src/FastLED.h:79:52: note:   'NSFastLED::WS2812'
 template<uint8_t DATA_PIN, EOrder RGB_ORDER> class WS2812 : public WS2812Controller800Khz<DATA_PIN, RGB_ORDER> {};
                                                    ^
meteorshower.ino:25:33: error: 'GRB' was not declared in this scope
meteorshower.ino:25:33: note: suggested alternative:
In file included from lib/FastLED/src/controller.h:5:0,
                 from lib/FastLED/src/FastLED.h:37,
                 from meteorshower.ino:15:
lib/FastLED/src/pixeltypes.h:810:2: note:   'GRB'
  GRB=0102,
  ^
meteorshower.ino: In function 'void loop()':
meteorshower.ino:35:15: error: 'meteorShower' was not declared in this scope
meteorshower.ino: In function 'void meteorShower()':
meteorshower.ino:75:31: error: invalid use of incomplete type 'struct CRGB'
meteorshower.ino:5:8: error: forward declaration of 'struct CRGB'
meteorshower.ino:81:40: error: 'CHSV' was not declared in this scope
meteorshower.ino:81:40: note: suggested alternative:
In file included from lib/FastLED/src/controller.h:5:0,
                 from lib/FastLED/src/FastLED.h:37,
                 from meteorshower.ino:15:
lib/FastLED/src/pixeltypes.h:18:8: note:   'NSFastLED::CHSV'
 struct CHSV {
        ^
meteorshower.ino:135:15: error: incomplete type 'CRGB' used in nested name specifier
meteorshower.ino:143:3: error: 'FastLED' was not declared in this scope
meteorshower.ino:143:3: note: suggested alternative:
In file included from meteorshower.ino:15:0:
lib/FastLED/src/FastLED.h:460:17: note:   'NSFastLED::FastLED'
 extern CFastLED FastLED;
                 ^
../build/module.mk:267: recipe for target '../build/target/user/platform-6-msrc/meteorshower.o' failed
make[2]: Leaving directory '/firmware/user'
make[2]: *** [../build/target/user/platform-6-msrc/meteorshower.o] Error 1
../../../build/recurse.mk:11: recipe for target 'user' failed
make[1]: Leaving directory '/firmware/modules/photon/user-part'
make[1]: *** [user] Error 2
../build/recurse.mk:11: recipe for target 'modules/photon/user-part' failed
make: *** [modules/photon/user-part] Error 2

Just add this line after the include statement

FASTLED_USING_NAMESPACE

And please use A2 instead of 12 for your #define LED_PIN

1 Like

THANK YOU!

Ah yes, I changed those variables. LED_COUNT is actually 144 and LED_PIN is actually D1

Thanks for the help!

@kkwak Here is a web page with code for quite a few different style of neo pixels display patterns that I ran across the other day.

2 Likes

@RWB Thanks! I came across these too. Unfortunately I just bought a bunch of RGBW strips which the FastLED library doesn’t seem to work on.

The code on that site works with the neopixels also, you just have to add their initial code to get the animations working. Took me a min to figure out.

@RWB I know it works for RGB neopixels but I don’t think the FastLED library supports RGBW neopixel strips yet