Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #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 "\x04"
- EFFECT_SCROLL_UP "HELLO "
- EFFECT_SCROLL_UP "WORLD "
- };
- uint16_t Options;
- void setup()
- {
- FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds[0], leds.Size());
- FastLED.setBrightness(30);
- 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, 5);
- ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
- ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 0xff, 0x00, 0xff);
- Options = INSTANT_OPTIONS_MODE;
- ScrollingMsg.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);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement