Advertisement
wrybread

example1

Dec 18th, 2022 (edited)
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.10 KB | None | 0 0
  1. #include <FastLED.h>
  2.  
  3. #include <LEDMatrix.h>
  4. #include <LEDText.h>
  5. #include <FontMatrise.h>
  6.  
  7. // Change the next 6 defines to match your matrix type and size
  8.  
  9. #define LED_PIN 23
  10. #define COLOR_ORDER GRB
  11. #define CHIPSET WS2812B
  12.  
  13. #define MATRIX_WIDTH 8
  14. #define MATRIX_HEIGHT 8
  15. #define MATRIX_TYPE HORIZONTAL_MATRIX
  16.  
  17. cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds;
  18.  
  19. cLEDText ScrollingMsg;
  20.  
  21. const unsigned char TxtDemo[] = {
  22. //EFFECT_SCROLL_LEFT " LEFT SCROLL "
  23. //EFFECT_SCROLL_RIGHT " LLORCS THGIR"
  24. //EFFECT_SCROLL_DOWN " SCROLL DOWN SCROLL DOWN " EFFECT_FRAME_RATE "\x04" " SCROLL DOWN " EFFECT_FRAME_RATE "\x00" " "
  25. //EFFECT_SCROLL_UP " SCROLL UP SCROLL UP " EFFECT_FRAME_RATE "\x04" " SCROLL UP " EFFECT_FRAME_RATE "\x00" " "
  26. //EFFECT_CHAR_UP EFFECT_SCROLL_LEFT " UP"
  27. //EFFECT_CHAR_RIGHT " RIGHT"
  28. //EFFECT_CHAR_DOWN "35"
  29. //EFFECT_SCROLL_LEFT "46"
  30. " 50"
  31. //EFFECT_CHAR_LEFT " LEFT"
  32. //EFFECT_HSV_CV "\x00\xff\xff\x40\xff\xff" EFFECT_CHAR_UP " HSV_CV 00-40"
  33. //EFFECT_HSV_CH "\x00\xff\xff\x40\xff\xff" " HSV_CH 00-40"
  34. //EFFECT_HSV_AV "\x00\xff\xff\x40\xff\xff" " HSV_AV 00-40"
  35. //EFFECT_HSV_AH "\x00\xff\xff\xff\xff\xff" " HSV_AH 00-FF"
  36. //" " EFFECT_HSV "\x00\xff\xff" "R" EFFECT_HSV "\x20\xff\xff" "A" EFFECT_HSV "\x40\xff\xff" "I" EFFECT_HSV "\x60\xff\xff" "N" EFFECT_HSV "\xe0\xff\xff" "B" EFFECT_HSV "\xc0\xff\xff" "O"
  37. //EFFECT_HSV "\xa0\xff\xff" "W" EFFECT_HSV "\x80\xff\xff" "S " EFFECT_DELAY_FRAMES "\x00\x96" EFFECT_RGB "\xff\xff\xff"
  38. };
  39.  
  40. void setup()
  41. {
  42. FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds[0], leds.Size());
  43. FastLED.setBrightness(64);
  44. FastLED.clear(true);
  45. delay(500);
  46.  
  47. ScrollingMsg.SetFont(MatriseFontData);
  48. ScrollingMsg.Init(&leds, leds.Width(), ScrollingMsg.FontHeight() + 1, 0, 0);
  49. ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
  50. ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 0xff, 0x00, 0xff);
  51.  
  52. // "With a change of scroll direction any existing text will be scrolled off the message area before the new direction is applied unless the INSTANT_OPTIONS_MODE has been set."
  53. // (Makes the text not scroll all the way off the matrix)
  54. ScrollingMsg.SetOptionsChangeMode(INSTANT_OPTIONS_MODE);
  55. }
  56.  
  57.  
  58. void loop()
  59. {
  60. if (ScrollingMsg.UpdateText() == -1)
  61. ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
  62. else
  63. FastLED.show();
  64. delay(100);
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement