Go Down

Topic: no matching function for call to 'CFastLED::addLeds(CRGB [300], int)' (Read 151 times) previous topic - next topic

pleasehelp444

I am trying to make twang: https://bavatuesdays.com/building-a-line-wobbler-clone-with-twang/

But I keep getting this error message:
Code: [Select]
no matching function for call to 'CFastLED::addLeds(CRGB [300], int)'

Here is my code: https://pastebin.com/MX8AjxgQ

Thanks so much for any help!

ballscrewbob

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.
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

pleasehelp444

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.

Sorry  :(

Do you know how I can solve this problem with the code? Or how I can move this post to the LED section because no one seems to know here.

gfvalvo

Start by posting your code here on the forum using code tags. Why make us go to some random, sketchy web site to view it?
No technical questions via PM. They will be ignored. Post your questions in the forum so that all may learn.

pleasehelp444

Start by posting your code here on the forum using code tags. Why make us go to some random, sketchy web site to view it?
It wouldn't let me paste it because it exceeded the character limit - I thought pastebin.com was a good way to bypass it so I tried that. Sorry

gfvalvo

If your code is too long to post, people probably won't want to spend their time digging through it. Especially, if it's messy and contains too much stuff unrelated to your problem.

The best thing is to post an MCVE. This is the smallest possible complete code that demonstrates the exact problem you're seeing and includes nothing unrelated to your problem.
No technical questions via PM. They will be ignored. Post your questions in the forum so that all may learn.

pleasehelp444

If your code is too long to post, people probably won't want to spend their time digging through it. Especially, if it's messy and contains too much stuff unrelated to your problem.

The best thing is to post an MCVE. This is the smallest possible complete code that demonstrates the exact problem you're seeing and includes nothing unrelated to your problem.
// Fast LED
  FastLED.addLeds<WS2812B, DATA_PIN, CLOCK_PIN, LED_COLOR_ORDER>(leds, 300);
  FastLED.setBrightness(BRIGHTNESS);
  FastLED.setDither(1);

This is the section causing the problem. The code is quite clean- I didn't write it. You can find it on GitHub https://github.com/Critters/TWANG

The first bit of the code is this

// Required libs
#include "FastLED.h"
#include "I2Cdev.h"
#include "MPU6050.h"
#include "Wire.h"
#include "toneAC.h"
#include "iSin.h"
#include "RunningMedian.h"

// Included libs
#include "Enemy.h"
#include "Particle.h"
#include "Spawner.h"
#include "Lava.h"
#include "Boss.h"
#include "Conveyor.h"

pleasehelp444

I did an update and now I am getting this message:

no matching function for call to 'CFastLED::addLeds<WS2812B, 3, 4, BGR>(CRGB [300], int)'

It seems to be caused by the same thing

gfvalvo

The code at the GitHub you linked: https://github.com/Critters/TWANG is using an APA102 LED strip. Those LEDS have data and clock inputs. The WS2812B LED you're specifying in your code do not use a clock pin. Yet, you're trying to tell FastLED that it does. So, the compiler is correct, you're trying to call a function that doesn't exist for the LEDs you've specified.


No technical questions via PM. They will be ignored. Post your questions in the forum so that all may learn.

gfvalvo

BTW, when I asked you to post an MCVE, this is what I meant.:
Code: [Select]
#include "FastLED.h"

#define NUM_LEDS 300
#define DATA_PIN 3
#define CLOCK_PIN 4
#define LED_COLOR_ORDER BGR

CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<WS2812B, DATA_PIN, CLOCK_PIN, LED_COLOR_ORDER>(leds, NUM_LEDS);
}

void loop() {
}

Note that it's small (less than 20 lines), complete, and shows the exact same compiler error message that you were getting. And, it's in Code Tags.
No technical questions via PM. They will be ignored. Post your questions in the forum so that all may learn.

TheMemberFormerlyKnownAsAWOL

BTW, when I asked you to post an MCVE, this is what I meant.:
Code: [Select]
#include "FastLED.h"

#define NUM_LEDS 300
#define DATA_PIN 3
#define CLOCK_PIN 4
#define LED_COLOR_ORDER BGR

CRGB leds[NUM_LEDS];

void setup() {
  FastLED.addLeds<WS2812B, DATA_PIN, CLOCK_PIN, LED_COLOR_ORDER>(leds, NUM_LEDS);
}

void loop() {
}

Note that it's small (less than 20 lines), complete, and shows the exact same compiler error message that you were getting. And, it's in Code Tags.
That's an MRE (no, not that MRE to all you grunts), not a MCVE - it's not compilable.
Please don't PM technical questions - post them on the forum, then everyone benefits/suffers equally

gfvalvo

I used the term generically. But, on the page I linked, C is C(omplete):
Quote
a minimal, complete and verifiable example (mcve)
No technical questions via PM. They will be ignored. Post your questions in the forum so that all may learn.

oqibidipo

Code: [Select]
 FastLED.addLeds<WS2812B, DATA_PIN, CLOCK_PIN, LED_COLOR_ORDER>(leds, NUM_LEDS);
WS2812B does not have a clock line, only a data line.
Remove CLOCK_PIN.

pleasehelp444

Code: [Select]
  FastLED.addLeds<WS2812B, DATA_PIN, CLOCK_PIN, LED_COLOR_ORDER>(leds, NUM_LEDS);
WS2812B does not have a clock line, only a data line.
Remove CLOCK_PIN.

The code at the GitHub you linked: https://github.com/Critters/TWANG is using an APA102 LED strip. Those LEDS have data and clock inputs. The WS2812B LED you're specifying in your code do not use a clock pin. Yet, you're trying to tell FastLED that it does. So, the compiler is correct, you're trying to call a function that doesn't exist for the LEDs you've specified.



This worked! Thanks so much. Now that the LEDs are working, there are no errors. The only problem is the gyroscope - it doesn't seem to be letting me move the player, even though the light is on on it. I have the GND plugged into GND, VCC in 3.3V, SCL and SCA in the two at the end of the PWM side, I've tried moving the SCL and SDA to lots of different pins and nothing seems to work, and INT in 2. Do you have any idea why it wouldn't be working? Thanks again!

Go Up