I am trying to create a custom Arduino library that uses another library. I want to be able to initialize a library within my library this is what I got so far. It works well but I need to be able to make multiple instances and change the variable that are required when initializing the library.
The .ino
#include "audiolux.h"
#include <FastLED.h>
Audiolux al1;
void setup() {
}
void loop() {
al1.runs();
}
The .ccp file:
#include "Arduino.h"
#include "audiolux.h"
#include <FastLED.h>
Audiolux::Audiolux()
{
FastLED.addLeds<NEOPIXEL, 6>(leds, 100);
}
void Audiolux::runs(){
leds[2] = CRGB::Red;
FastLED.show();
}
The .h file
#ifndef audiolux_h
#define audiolux_h
#include "Arduino.h"
#include <FastLED.h>
class Audiolux
{
public:
Audiolux();
void runs();
private:
CRGB leds[100];
};
#endif
For example, in the header file the CRGB is initialized as leds[100], how would I change it to be a variable I could address from the ino?