Advertisement
Terkel

Scrolling Matrix Test

Jun 28th, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1. #include <FastLED.h>
  2.  
  3. #include <LEDMatrix.h>
  4. #include <LEDText.h>
  5. #include <Font12x16.h>
  6.  
  7. // Change the next 6 defines to match your matrix type and size
  8.  
  9. #define LED_PIN        7
  10. #define COLOR_ORDER    GRB
  11. #define CHIPSET        WS2812B
  12.  
  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.  
  19. cLEDText ScrollingMsg;
  20.  
  21. const unsigned char TxtDemo[] = {
  22.                   EFFECT_FRAME_RATE "\x04"
  23.                                   EFFECT_SCROLL_UP "HELLO "  
  24.                                   EFFECT_SCROLL_UP "WORLD  "
  25. };
  26. uint16_t Options;
  27.  
  28. void setup()
  29. {
  30.   FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds[0], leds.Size());
  31.   FastLED.setBrightness(30);
  32.   FastLED.clear(true);
  33.   delay(500);
  34.   FastLED.showColor(CRGB::Red);
  35.   delay(1000);
  36.   FastLED.showColor(CRGB::Lime);
  37.   delay(1000);
  38.   FastLED.showColor(CRGB::Blue);
  39.   delay(1000);
  40.   FastLED.showColor(CRGB::White);
  41.   delay(1000);
  42.   FastLED.show();
  43.  
  44.   ScrollingMsg.SetFont(Font12x16Data);
  45.   ScrollingMsg.Init(&leds, leds.Width(), ScrollingMsg.FontHeight() + 14, 0, 5);
  46.   ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
  47.   ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 0xff, 0x00, 0xff);
  48.   Options = INSTANT_OPTIONS_MODE;
  49.   ScrollingMsg.SetOptionsChangeMode(Options);
  50. }
  51.  
  52.  
  53. void loop()
  54. {
  55.   if (ScrollingMsg.UpdateText() == -1)
  56.   {
  57.     ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
  58.     Options ^= INSTANT_OPTIONS_MODE;
  59.     ScrollingMsg.SetOptionsChangeMode(Options);
  60.   }
  61.   else
  62.     FastLED.show();
  63.   delay(10);
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement