Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This example shows the use of INSTANT_OPTIONS_MODE
- // When set it stops the text routine from having to scroll all
- // of the existing text off the display before changing the scroll
- // direction.
- #include <FastLED.h>
- #include <LEDMatrix.h>
- #include <LEDText.h>
- #include <Font12x16.h>
- // Change the next 6 defines to match your matrix type and size
- #define LED_PIN 7
- #define COLOR_ORDER GRB
- #define CHIPSET WS2812B
- #define MATRIX_WIDTH 12
- #define MATRIX_HEIGHT 46
- #define MATRIX_TYPE VERTICAL_ZIGZAG_MATRIX
- cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds;
- cLEDText ScrollingMsg;
- const unsigned char TxtDemo[] = { EFFECT_FRAME_RATE "\x02"
- // EFFECT_HSV_AH "\x00\xff\xff\xff\xff\xff"
- // EFFECT_SCROLL_LEFT " The "
- EFFECT_SCROLL_UP "Quick "
- // EFFECT_SCROLL_LEFT "Brown "
- // EFFECT_SCROLL_DOWN "Fox"
- // EFFECT_SCROLL_LEFT "Jumps "
- EFFECT_SCROLL_UP "Over "
- // EFFECT_SCROLL_LEFT "The "
- // EFFECT_SCROLL_DOWN "Lazy "
- // EFFECT_SCROLL_LEFT "Dog "
- };
- cLEDText ScrollingMsg2;
- const unsigned char TxtDemo2[] = {EFFECT_FRAME_RATE "\x03"
- EFFECT_SCROLL_UP "HELLO WORLD "
- };
- uint16_t Options;
- void setup()
- {
- FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds[0], leds.Size());
- FastLED.setBrightness(64);
- FastLED.clear(true);
- delay(500);
- FastLED.showColor(CRGB::Red);
- delay(1000);
- FastLED.showColor(CRGB::Lime);
- delay(1000);
- FastLED.showColor(CRGB::Blue);
- delay(1000);
- FastLED.showColor(CRGB::White);
- delay(1000);
- FastLED.show();
- ScrollingMsg.SetFont(Font12x16Data);
- ScrollingMsg.Init(&leds, leds.Width(), ScrollingMsg.FontHeight() + 14, 0, 0);
- ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
- ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 0xff, 0x00, 0xff);
- Options = INSTANT_OPTIONS_MODE;
- ScrollingMsg.SetOptionsChangeMode(Options);
- ScrollingMsg2.SetFont(Font12x16Data);
- ScrollingMsg2.Init(&leds, leds.Width(), ScrollingMsg2.FontHeight() + 14, 0, 0);
- ScrollingMsg2.SetText((unsigned char *)TxtDemo2, sizeof(TxtDemo2) - 1);
- ScrollingMsg2.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 100, 000, 255);
- Options = INSTANT_OPTIONS_MODE;
- ScrollingMsg2.SetOptionsChangeMode(Options);
- }
- void loop()
- {
- if (ScrollingMsg.UpdateText() == -1)
- {
- ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
- Options ^= INSTANT_OPTIONS_MODE;
- ScrollingMsg.SetOptionsChangeMode(Options);
- }
- else
- FastLED.show();
- delay(10);
- }
- {
- if (ScrollingMsg2.UpdateText() == -1)
- {
- ScrollingMsg2.SetText((unsigned char *)TxtDemo2, sizeof(TxtDemo2) - 1);
- Options ^= INSTANT_OPTIONS_MODE;
- ScrollingMsg2.SetOptionsChangeMode(Options);
- }
- else
- FastLED.show();
- delay(10);
- }
Advertisement
Add Comment
Please, Sign In to add comment