Guest User

filteredDownProblem

a guest
Mar 12th, 2018
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.97 KB | None | 0 0
  1. #include "FastLED.h"
  2.  
  3. #define NUM_LEDS 245
  4. #define DATA_PIN 14
  5. #define CLOCK_PIN 13
  6.  
  7. byte i = 1;
  8. unsigned char brightness = 50;
  9. CRGB bottomLeds[NUM_LEDS]; // Here is our FastLED Object
  10.  
  11. /////////////////////////////// class SolidColors //////////////////////////////////////////////////////////
  12. /* 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  */
  13. class SolidColors
  14. {
  15.   public:
  16.     SolidColors(unsigned char strip, int rLevel, int gLevel, int bLevel, CRGB *LED_Array);  
  17.     int stripNumber;
  18.     int redLevel;
  19.     int greenLevel;
  20.     int blueLevel;
  21.     void begins();
  22.     CRGB *LED_Array;
  23. };
  24.  
  25. /*///////////// Constructor /////////////////*/
  26. SolidColors::SolidColors(unsigned char strip, int rLevel, int gLevel, int bLevel, CRGB*LED_Array){
  27.     stripNumber = strip;
  28.     redLevel = rLevel;
  29.     greenLevel = gLevel;
  30.     blueLevel = bLevel;
  31. }
  32. /*////////// End of Constructor ///////////////*/  
  33.  
  34.  
  35. void SolidColors::begins(){  
  36.      Serial.print(" Begins fired off. ");
  37.      for(int iLed = 0; iLed < NUM_LEDS; iLed++){
  38.           //LED_Array[iLed].r = redLevel;      
  39.           //LED_Array[iLed].g = greenLevel;    
  40.           //LED_Array[iLed].b = blueLevel;
  41.      }
  42. }
  43. /*//////////////////////// End of class SolidColors ///////////////////////////////////////////////////////////////////////////////*/
  44.  
  45. 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".
  46.  
  47. void setup() {
  48.      Serial.begin(115200);
  49.      FastLED.addLeds<SK9822, DATA_PIN, CLOCK_PIN, BGR, DATA_RATE_MHZ(10)>(bottomLeds, NUM_LEDS);
  50.      LEDS.setBrightness(brightness);
  51. }
  52.  
  53. void loop() {  
  54.      while(i==1){
  55.          i = 0;
  56.          PersistantColor.begins();
  57.          Serial.print("This message should show only once.");
  58.          FastLED.show();              
  59.      }    
  60. }
Advertisement
Add Comment
Please, Sign In to add comment