Last active
October 1, 2018 11:19
-
-
Save hpwit/19e237f4d4cf3545a6f26f8c135e4753 to your computer and use it in GitHub Desktop.
class for strips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//You would have a class define like this | |
class Strip | |
{ | |
public: | |
CRGB *leds; | |
Strip(int num_leds); | |
void Comet(CRGB color); | |
void OTC(CRGB color); | |
void Ravel(CRGB color); | |
int numLeds=0; | |
} | |
Strip::Strip(int num_leds) | |
{ | |
leds =(CRGB*)malloc(num_leds*sizeof(CRGB)) ; | |
if(leds==NULL) | |
{ | |
Serial.println("Error not able to create the strip"); | |
} | |
else | |
{ | |
numLeds=num_leds; | |
} | |
} | |
//the way you use it | |
Strip strip1=Strip(200); | |
if(strip1.numLeds>0) | |
FastLED.addLeds<..,2>(strip1.leds, strip1£.numLeds); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment