I need help with a specific issue. I have minimized my code for troubleshooting purposes and the code is on pastebin. I’m trying to pass a pointer to a FastLED CRGB Array into a Object(SolidColor), so that said object can modify the Array.
In the code I have written, there is a method(Function) SolidColors::begins(). It tries to set the rgb values in the FastLED CRGB object. It compiles without errors, but leads to constant resets of the ESP8266.
I am using a Sparkfun Thingy Development Board
Arduino version 1.6.5
FastLED version 3.1.6
#include “FastLED.h”
#define NUM_LEDS 245
#define DATA_PIN 14
#define CLOCK_PIN 13
byte i = 1;
unsigned char brightness = 50;
CRGB bottomLeds[NUM_LEDS]; // Here is our FastLED Object
/////////////////////////////// class SolidColors //////////////////////////////////////////////////////////
/* The class constructor takes 4 inputs. Three inputs for RGB values, and one input of a pointer to a fastLED CGRB Object Array we wish to modifiy */
class SolidColors
{
public:
SolidColors(unsigned char strip, int rLevel, int gLevel, int bLevel, CRGB *LED_Array);
int stripNumber;
int redLevel;
int greenLevel;
int blueLevel;
void begins();
CRGB *LED_Array;
};
////////////// Constructor //////////////////
SolidColors::SolidColors(unsigned char strip, int rLevel, int gLevel, int bLevel, CRGB*LED_Array){
stripNumber = strip;
redLevel = rLevel;
greenLevel = gLevel;
blueLevel = bLevel;
}
/////////// End of Constructor ////////////////
void SolidColors::begins(){
Serial.print(" Begins fired off. ");
for(int iLed = 0; iLed < NUM_LEDS; iLed++){
//LED_Array[iLed].r = redLevel;
//LED_Array[iLed].g = greenLevel;
//LED_Array[iLed].b = blueLevel;
}
}
///////////////////////// End of class SolidColors ////////////////////////////////////////////////////////////////////////////////
SolidColors PersistantColor(1,0,0,200,bottomLeds); // Here is where we institaniate an Object of class SolidColors and pass in a pointer to the FastLED CRGB Object “botomLeds”.
void setup() {
Serial.begin(115200);
FastLED.addLeds<SK9822, DATA_PIN, CLOCK_PIN, BGR, DATA_RATE_MHZ(10)>(bottomLeds, NUM_LEDS);
LEDS.setBrightness(brightness);
}
void loop() {
while(i==1){
i = 0;
PersistantColor.begins();
Serial.print(“This message should show only once.”);
FastLED.show();
}
}