Fastled.setSpeed(x)

Hello all,

In my code i’m using the following command in the setup:

FastLED.setSpeed(SPEED)

SPEED is declared as:
uint8_t SPEED = 40;

But unfortunately the compiler says the following:

'class CFastLED' has no member named 'setSpeed'|

I’m including ‘FastLED.h’ library, and also tried including ‘FastLEDPainter.h’, but unfortunately without any difference yet.

Now, when i look at the documentation for the FastLEDPainter library, it says the following:

void setSpeed(int16_t speed)
set the speed of the brush. since sub-pixel speed is used, one pixel per iteration is (1<<12) or 4095

(Found at the following page: GitHub - DedeHai/FastLEDPainter: Arduino library for easy creation of LED strip animations, based on the FastLED library. )

Shouldn’t I be abled to use the code as mentioned above?
Or, how could i make such a function? Preferably without delays as i’m using a rotary encoder and oled simultaneously with the led strips.

setSpeed() is a function of the FastLEDPainter library, not the FastLED library, thus the error.

Please post your full sketch. If possible you should always post code directly in the forum thread as text using code tags (</> button on the toolbar). This will make it easy for anyone to look at it, which will increase the likelihood of you getting help. If the sketch is longer than the forum will allow then it’s ok to add it as an attachment.

Thanks for your reply!

As mentioned, i’ve also tried it with including:

#include <FastLEDPainter.h>

Also then, the following command:

FastLED.setSpeed(x);

Gives the same error:

'class CFastLED' has no member named 'setSpeed'|

Any mistakes made here?

The reason i did not immediately include the complete sketch is because it’s quite a large one, making it less easy to look at the question.
If still required, i’ll post the complete sketch.

Thanks in advance!

Let’s look at the example sketch that comes with the FastLEDPainter library:

Here’s where they use setSpeed():

 pixelbrush.setSpeed(1200); //set the brush movement speed (4096 means to move one pixel per update)

Notice it doesn’t say FastLED.setSpeed(1200), it says pixelbrush.setSpeed(1200).

So where did this pixelbrush thing come from? Right here:

FastLEDPainterBrush pixelbrush = FastLEDPainterBrush(&pixelcanvas); //crete brush, linked to the canvas to paint to

Now in your code you might have given that object a different name so without seeing your code I can’t say exactly how to use setSpeed() but you get the idea.