Код: Выделить всё
// LogoLED.h
#ifndef LOGOLED_H
#define LOGOLED_H
#include
class LogoLED
{
public:
LogoLED(uint8_t numLeds, uint8_t dataPin);
void begin();
// ... other methods ...
private:
uint8_t _numLeds;
uint8_t _dataPin;
CRGB *_leds;
bool _isOn;
};
#endif
Код: Выделить всё
// LogoLED.cpp
#include "LogoLED.h"
LogoLED::LogoLED(uint8_t numLeds, uint8_t dataPin) : _numLeds(numLeds), _dataPin(dataPin), _isOn(false)
{
_leds = new CRGB[_numLeds];
}
void LogoLED::begin()
{
FastLED.addLeds(_leds, _numLeds);
off();
}
// ... other methods ...
Код: Выделить всё
// main.cpp
#include
#include "LogoLED.h"
#define LED_PIN 6
LogoLED logoLED(4, LED_PIN);
void setup()
{
logoLED.begin();
// ... more setup code ...
}
void loop()
{
// ... loop code ...
}
Код: Выделить всё
CopyNo instance of overloaded function "CFastLED::addLeds" matches the argument list.
Argument types are: (CRGB *, uint8_t)
Object type is: CFastLED
Подробнее здесь: https://stackoverflow.com/questions/790 ... onstructor