Advertisement
Terkel

matrix scroll

Jul 6th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 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.  
  19. cLEDText ScrollingMsg;
  20.  
  21. void Init( uint16_t = MATRIX_WIDTH, uint16_t = MATRIX_HEIGHT, int16_t OriginX = 0, int16_t OriginY = 0);
  22.  
  23. const unsigned char AweSome[] = { EFFECT_FRAME_RATE "\x02"
  24. EFFECT_SCROLL_UP " EVERYTHING"
  25. //EFFECT_RGB "0, 100, 255"
  26. };
  27.  
  28. const unsigned char WelCome[] = { EFFECT_FRAME_RATE "\x02"
  29. EFFECT_SCROLL_UP " HELLO WORLD"
  30. //EFFECT_HSV_AH "\x00\xff\xff"
  31. EFFECT_DELAY_FRAMES "\01\x00"
  32. };
  33.  
  34.  
  35. uint16_t Options;
  36.  
  37. void setup()
  38. {
  39. FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds[0], leds.Size());
  40. FastLED.setBrightness(BRIGHTNESS);
  41. FastLED.clear(true);
  42. delay(500);
  43. FastLED.showColor(CRGB::Red);
  44. delay(1000);
  45. FastLED.showColor(CRGB::Lime);
  46. delay(1000);
  47. FastLED.showColor(CRGB::Blue);
  48. delay(1000);
  49. FastLED.showColor(CRGB::White);
  50. delay(1000);
  51. FastLED.show();
  52.  
  53. ScrollingMsg.SetFont(Font12x16Data);
  54. //ScrollingMsg.Init(&leds, leds.Width(), ScrollingMsg.FontHeight() + 30, 0, 2); //offsset top distance to 14 Begin, letters at 2 pixels in
  55. ScrollingMsg.Init(&leds, leds.Width(), leds.Height() + 14, 0, 0);
  56. ScrollingMsg.SetText((unsigned char *)AweSome, sizeof(AweSome) - 1);
  57. // ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 200, 0, 255);
  58.  
  59. }
  60.  
  61. void loop()
  62. {
  63. if (ScrollingMsg.UpdateText() == -1)
  64. {
  65. ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 200, 0, 255);
  66. ScrollingMsg.SetText((unsigned char *)AweSome, sizeof(AweSome) - 1);
  67.  
  68. ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 100, 0, 200);
  69. ScrollingMsg.SetText((unsigned char *)WelCome, sizeof(WelCome) - 1);
  70.  
  71. }
  72. else
  73. FastLED.show();
  74. delay(10);
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement