Hey guys!
I'm trying to generalize an API for some led projects using octoWS2811 library and I'm having some problems.
I want to put the octoWS object inside a class so it will be easier to handle, but when I upload and run the code it does not seem to work.
the class definition (BasicLed.h) :
first of all for the display & drawing memory, if I dont define them as static I get a duplicate veriable error. I would really like to understand why, I dont declare them anywhere else in the code nor accept them as function inputs.
2nd when I use the BasicLed class and try to light some leds nothing seems to work.
Main.cpp code:
ocotows.begin() is used in the constructor of the BasicLed class.
Thanks for the help guys!
I'm trying to generalize an API for some led projects using octoWS2811 library and I'm having some problems.
I want to put the octoWS object inside a class so it will be easier to handle, but when I upload and run the code it does not seem to work.
the class definition (BasicLed.h) :
Code:
#include <Arduino.h>
#include "OctoWS2811.h"
#include "FastLED.h"
#include "Defines.h"
static DMAMEM int displayMemory[LEDSPERSTRIP*6];
static int drawingMemory[LEDSPERSTRIP*6];
static const int config = WS2811_GRB | WS2811_800kHz;
class BasicLed{
private:
CRGB fastled[NUMOFPIX];
// octo veriables
OctoWS2811 octo = OctoWS2811(LEDSPERSTRIP, displayMemory, drawingMemory, config);
public:
BasicLed();
void set_color (u16 index ,u32 color);
void fast2octo();
void show();
static u32 rgb2word(u8 r, u8 g, u8 b);
void clear();
};
first of all for the display & drawing memory, if I dont define them as static I get a duplicate veriable error. I would really like to understand why, I dont declare them anywhere else in the code nor accept them as function inputs.
2nd when I use the BasicLed class and try to light some leds nothing seems to work.
Main.cpp code:
Code:
#include "BasicLed.h"
BasicLed led;
void setup() {
led.set_color(0,RMASK);
led.show();
}
void loop() {
}
ocotows.begin() is used in the constructor of the BasicLed class.
Thanks for the help guys!