Advertisement
Guest User

MultiMatrix

a guest
Jul 6th, 2016
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.46 KB | None | 0 0
  1. #include <FastLED.h>
  2. #include <LEDMatrix.h>
  3. #include <LEDText.h>
  4. #include <Font12x16.h>
  5.  
  6. // Change the next 6 defines to match your matrix type and size
  7.  
  8. #define LED_PIN        7
  9. #define LED_PIN2       8
  10. #define COLOR_ORDER    GRB
  11. #define CHIPSET        WS2812B
  12. #define BRIGHTNESS     40
  13. #define MATRIX_WIDTH   12
  14. #define MATRIX_HEIGHT  46
  15. #define MATRIX_TYPE    VERTICAL_ZIGZAG_MATRIX
  16.  
  17. cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds;
  18. cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds2;
  19.  
  20. cLEDText ScrollingMsg;
  21. cLEDText ScrollingMsg2;
  22.  
  23.  
  24. const unsigned char AweSome[] = { EFFECT_FRAME_RATE "\x02"
  25.                                   EFFECT_SCROLL_UP "   EVERYTHING"
  26.                                   //EFFECT_RGB "0, 100, 255"
  27.                                   };
  28.  
  29. const unsigned char WelCome[] = { EFFECT_FRAME_RATE "\x02"
  30.                                   EFFECT_SCROLL_UP "    HELLO WORLD"  
  31.                                   //EFFECT_HSV_AH "\x00\xff\xff"
  32.                                   EFFECT_DELAY_FRAMES "\01\x00"
  33.                                   };
  34.                                
  35.  
  36. uint16_t Options;
  37.  
  38. void setup()
  39. {
  40.   FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds[0], leds.Size());
  41.   FastLED.addLeds<CHIPSET, LED_PIN2, COLOR_ORDER>(leds2[0], leds2.Size());
  42.   FastLED.setBrightness(BRIGHTNESS);
  43.   FastLED.clear(true);
  44.   delay(500);
  45.   FastLED.showColor(CRGB::Red);
  46.   delay(1000);
  47.   FastLED.showColor(CRGB::Lime);
  48.   delay(1000);
  49.   FastLED.showColor(CRGB::Blue);
  50.   delay(1000);
  51.   FastLED.showColor(CRGB::White);
  52.   delay(1000);
  53.   FastLED.show();
  54.  
  55.   ScrollingMsg.SetFont(Font12x16Data);
  56.   ScrollingMsg.Init(&leds, leds.Width(), leds.Height(), 0, 0);
  57.   ScrollingMsg.SetText((unsigned char *)AweSome, sizeof(AweSome) - 1);
  58.     ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 200, 0, 255);
  59.  
  60.   ScrollingMsg2.SetFont(Font12x16Data);
  61.   ScrollingMsg2.Init(&leds2, leds2.Width(), leds2.Height(), 0, 0);
  62.   ScrollingMsg2.SetText((unsigned char *)WelCome, sizeof(WelCome) - 1);
  63.     ScrollingMsg2.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 100, 0, 200);
  64. }
  65.  
  66. void loop()
  67. {
  68.   if (ScrollingMsg.UpdateText() == -1)
  69.   {
  70.     ScrollingMsg.SetText((unsigned char *)AweSome, sizeof(AweSome) - 1);
  71.     ScrollingMsg.UpdateText();
  72.   }
  73.   if (ScrollingMsg2.UpdateText() == -1)
  74.   {
  75.     ScrollingMsg2.SetText((unsigned char *)WelCome, sizeof(WelCome) - 1);
  76.     ScrollingMsg2.UpdateText()
  77.   }
  78.   FastLED.show();
  79.   delay(10);
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement