Getting numerous errors using the FastLED library

#include <LED.h>

#include <bitswap.h>
#include <chipsets.h>
#include <color.h>
#include <colorpalettes.h>
#include <colorutils.h>
#include <controller.h>
#include <cpp_compat.h>
#include <dmx.h>
#include <FastLED.h>
#include <fastled_config.h>
#include <fastled_delay.h>
#include <fastled_progmem.h>
#include <fastpin.h>
#include <fastspi.h>
#include <fastspi_bitbang.h>
#include <fastspi_dma.h>
#include <fastspi_nop.h>
#include <fastspi_ref.h>
#include <fastspi_types.h>
#include <hsv2rgb.h>
#include <led_sysdefs.h>
#include <lib8tion.h>
#include <noise.h>
#include <pixelset.h>
#include <pixeltypes.h>
#include <platforms.h>
#include <power_mgt.h>
#define NUM_LEDS 54
#define LED_PIN 7
CRGB led[NUM_LEDS]

void setup() {
  // put your setup code here, to run once:
pinMode(7, 5);
FastLED.addLeds<NEOPIXEL, LED_PIN>(led, NUM_LEDS);

for (int i = 0; i < NUM_LEDS; i++) {
     led[i] = CRGB(0,0, 255);  
}
 FastLED.show()

 void setBlue(int val) {  
  for (int i = 0; i < NUM_LEDS; i++){ 
    led[i] = CRGB(0, 0, val);
    }
    FastLED.show()
  
}
void loop() {  
  // put your main code here, to run repeatedly:
 for (int i = 255; i > 0; i++) {
     setBlue(i);
     delay(300)
 }

Here is the error message

Arduino: 1.8.1 (Windows 10), Board: "Arduino/Genuino Uno"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\cathe\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\cathe\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\cathe\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10801 -build-path C:\Users\cathe\AppData\Local\Temp\arduino_build_557767 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Users\cathe\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\5.4.0-atmel3.6.1-arduino2 -prefs=runtime.tools.avrdude.path=C:\Users\cathe\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino14 -prefs=runtime.tools.arduinoOTA.path=C:\Users\cathe\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.2.1 -verbose C:\Users\cathe\Documents\Arduino\sketch_feb21a\sketch_feb21a.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\cathe\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\cathe\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\cathe\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10801 -build-path C:\Users\cathe\AppData\Local\Temp\arduino_build_557767 -warnings=none -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avr-gcc.path=C:\Users\cathe\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\5.4.0-atmel3.6.1-arduino2 -prefs=runtime.tools.avrdude.path=C:\Users\cathe\AppData\Local\Arduino15\packages\arduino\tools\avrdude\6.3.0-arduino14 -prefs=runtime.tools.arduinoOTA.path=C:\Users\cathe\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.2.1 -verbose C:\Users\cathe\Documents\Arduino\sketch_feb21a\sketch_feb21a.ino
Using board 'uno' from platform in folder: C:\Users\cathe\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.23
Using core 'arduino' from platform in folder: C:\Users\cathe\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.23
Detecting libraries used...
"C:\Users\cathe\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\5.4.0-atmel3.6.1-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\cathe\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.23\cores\arduino" "-IC:\Users\cathe\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.23\variants\standard" "C:\Users\cathe\AppData\Local\Temp\arduino_build_557767\sketch\sketch_feb21a.ino.cpp" -o "nul"
"C:\Users\cathe\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\5.4.0-atmel3.6.1-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\cathe\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.23\cores\arduino" "-IC:\Users\cathe\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.23\variants\standard" "-IC:\Users\cathe\Documents\Arduino\libraries\LED" "C:\Users\cathe\AppData\Local\Temp\arduino_build_557767\sketch\sketch_feb21a.ino.cpp" -o "nul"
"C:\Users\cathe\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\5.4.0-atmel3.6.1-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing  -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10801 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR   "-IC:\Users\cathe\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.23\cores\arduino" "-IC:\Users\cathe\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.23\variants\standard" "-IC:\Users\cathe\Documents\Arduino\libraries\LED" "C:\Users\cathe\AppData\Local\Temp\arduino_build_557767\sketch\sketch_feb21a.ino.cpp" -o "C:\Users\cathe\AppData\Local\Temp\arduino_build_557767\preproc\ctags_target_for_gcc_minus_e.cpp"
In file included from C:\Users\cathe\Documents\Arduino\sketch_feb21a\sketch_feb21a.ino:3:0:

C:\Users\cathe\Documents\Arduino\libraries\LED/LED.:23:23: fatal error: WProgram.h: No such file or directory

compilation terminated.

Using library LED in folder: C:\Users\cathe\Documents\Arduino\libraries\LED (legacy)
exit status 1
Error compiling for board Arduino/Genuino Uno.

I've also been getting more errors with the void setup and void loop

If anyone can help that would be amazing! :slight_smile:

Edit: The compiler error has been fixed, thanks! However, I have been running into a new error.

C:\Users\cathe\Documents\Arduino\libraries\FastLED/FastLED.h:14:21: note: #pragma message: FastLED version 3.002.001

 #    pragma message "FastLED version 3.002.001"

                     ^

sketch_feb21a:36: error: expected initializer before 'void'

 void setup() {

 ^

Using library LED in folder: C:\Users\cathe\Documents\Arduino\libraries\LED (legacy)
Using library FastLED at version 3.2.1 in folder: C:\Users\cathe\Documents\Arduino\libraries\FastLED 
exit status 1
expected initializer before 'void'

The compiler cannot find the file WProgram.h which is no surprise as it was only used in very old versions of the IDE. Look in the C:\Users\cathe\Documents\Arduino\libraries\LED folder. You will probably find 2 files, LED.h and LED.cpp. Open both of the files in a text editor and replace all instances of WProgram.h with Arduino.h Save the files and try the upload again

I did not look at your program in detail but do you really need so many libraries ?

Thank you!

These came from just including FastLED as a library, but I don't think I need most of them.

CRGB led[NUM_LEDS];

@lms2020di

Other post/duplicate DELETED
Please do NOT cross post / duplicate as it wastes peoples time and efforts to have more than one post for a single topic.

Continued cross posting could result in a time out from the forum.

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.
Other general help and troubleshooting advice can be found here.

lms2020di:
These came from just including FastLED as a library, but I don't think I need most of them.

Correct. You only need this:

#include <FastLED.h>

When you do Sketch > Include Library > FastLED, it adds #include directives for each of the .h files in the FastLED library folder.

However, that wasn't the cause of the error. The cause of the error was you adding this line:

#include <LED.h>

which has nothing to do with the FastLED library. I don't see anything in your code that even uses the LED library, so you can just remove that line.

I did notice this:

pinMode(7, 5);

Please spend some time studying the pinMode reference page so you can learn how to use that function correctly:

I also notice that you are missing several semicolons.

I also notice that you are missing closing braces on the ends of your functions.
A very helpful troubleshooting tool is the Auto Format feature (Tools > Auto Format in the Arduino IDE or Ctrl + B in the Arduino Web Editor). If you do an Auto Format and then compare the resulting indentation to your intended program structure, it will quickly point you to where there is a missing or extra brace.

Another useful feature of the Arduino IDE/Arduino Web Editor is that when you place the cursor next to one bracket, it puts a box around the matching bracket. In the Arduino IDE, if the cursor is next to the closing bracket and the opening bracket is off the screen then it will show the opening bracket line in a tool tip after a short delay.

Hello!

I'm working using the FastLED library and I'm getting the error mentioned above

Here is my code,

#include <bitswap.h>
#include <chipsets.h>
#include <color.h>
#include <colorpalettes.h>
#include <colorutils.h>
#include <controller.h>
#include <cpp_compat.h>
#include <dmx.h>
#include <FastLED.h>
#include <fastled_config.h>
#include <fastled_delay.h>
#include <fastled_progmem.h>
#include <fastpin.h>
#include <fastspi.h>
#include <fastspi_bitbang.h>
#include <fastspi_dma.h>
#include <fastspi_nop.h>
#include <fastspi_ref.h>
#include <fastspi_types.h>
#include <hsv2rgb.h>
#include <led_sysdefs.h>
#include <lib8tion.h>
#include <noise.h>
#include <pixelset.h>
#include <pixeltypes.h>
#include <platforms.h>
#include <power_mgt.h>
#define NUM_LEDS 54
#define LED_PIN 7
CRGB led[NUM_LEDS];

void setup() {
  // put your setup code here, to run once:
pinMode(7, 5);
FastLED.addLeds<NEOPIXEL, LED_PIN>(led, NUM_LEDS);

for (int i = 0; i < NUM_LEDS; i++) {
     led[i] = CRGB(0,0, 255);  
}
 FastLED.show();

 void setBlue(int val); 
  for (int i = 0; i < NUM_LEDS; i++){ 
    led[i] = CRGB(0, 0, 255);
    }
    FastLED.show();
  
 
void loop() {  
  // put your main code here, to run repeatedly:
 for (int i = 255; i > 0; i++) {
     setBlue(i);
     delay(300)
 }

And here is the error message

exit status 1
a function-definition is not allowed here before '{' token

Thanks in advance! :slight_smile:

You should be aware that the compiler does provide the line number of any errors it finds.

Auto format your code with ctrl-T and you will see the problem - mismatched curly braces.

And you should also be aware that the error message is scrollable and contains more than just that last line.

FastLED.show();
 
 
void loop() {

That's certainly not right.

Isn't this still this:
https://forum.arduino.cc/index.php?topic=668309.0

@lms2020di

You were warned about cross posting / duplication.
Please take the next 48 hours to read the following links.

Could you take a few moments to Learn How To Use The Forum.
It will help you get the best out of the forum in the future.
Other general help and troubleshooting advice can be found here.