LED-Mesh/LED-Mesh.ino
2019-10-16 20:14:55 +02:00

150 lines
5.6 KiB
C++

#include <FastLED.h>
#include <LEDMatrix.h>
#include <LEDText.h>
#include <Font4x5.h>
// Change the next 6 defines to match your matrix type and size
#define LED_PIN 5
#define COLOR_ORDER RGB
#define CHIPSET PL9823
#define NUM_LEDS 90
#define MATRIX_WIDTH 18
#define MATRIX_HEIGHT 5
#define MATRIX_TYPE VERTICAL_ZIGZAG_MATRIX
cLEDMatrix < -MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE > leds;
CRGB leds2[NUM_LEDS];
cLEDText ScrollingMsg;
const unsigned char TxtDemo[] = {
EFFECT_FRAME_RATE "\x05"
EFFECT_HSV_AH "\x00\xff\xff\xff\xff\xff" " WELCOME TO FABLAB CHEMNITZ >>> " "\x20"
EFFECT_HSV "\x20\xff\xff" " WILLKOMMEN IM FABLAB CHEMNITZ >>> " "\x20"
EFFECT_HSV "\xc0\xff\xff" " WELCOME TO FABLAB CHEMNITZ >>> " "\x20"
EFFECT_HSV_AV "\x00\xff\xff\x40\xff\xff" " WILLKOMMEN IM FABLAB CHEMNITZ >>> " "\x20"
EFFECT_HSV_AH "\x00\xff\xff\xff\xff\xff" " WELCOME TO FABLAB CHEMNITZ >>> " "\x20"
EFFECT_HSV "\x20\xff\xff" " WILLKOMMEN IM FABLAB CHEMNITZ >>> " "\x20"
EFFECT_HSV "\xc0\xff\xff" " WELCOME TO FABLAB CHEMNITZ >>> " "\x20"
EFFECT_HSV_AV "\x00\xff\xff\x40\xff\xff" " WILLKOMMEN IM FABLAB CHEMNITZ >>> " "\x20"
/*
EFFECT_FRAME_RATE "\x05"
EFFECT_HSV_AH "\x00\xff\xff\xff\xff\xff" " DEZENTRALE >>> " "\x20"
EFFECT_HSV "\x20\xff\xff" " WANN HAST DU ZUM LETZTEN MAL GESTAUNT ? >>> " "\x20"
EFFECT_HSV "\xc0\xff\xff" " DEZENTRALE >>> " "\x20"
EFFECT_HSV_AV "\x00\xff\xff\x40\xff\xff" " WANN HAST DU ZUM LETZTEN MAL GESTAUNT ? >>> " "\x20"
EFFECT_FRAME_RATE "\x06" EFFECT_BACKGND_DIMMING "\x20"
EFFECT_SCROLL_LEFT " LEEFT SCROLL "
EFFECT_SCROLL_RIGHT " LLORCS THGIR"
EFFECT_CHAR_UP EFFECT_SCROLL_LEFT " UP"
EFFECT_SCROLL_LEFT " Magande 2811 ABCDEFGHIJK "
EFFECT_FRAME_RATE "\x10"
EFFECT_SCROLL_LEFT " LMNOPQRSTUVWXYZ 0123456789 +*~,;:.-_!$%&/()=\" {[]}`^^#<>"
EFFECT_FRAME_RATE "\x06"
EFFECT_CHAR_RIGHT " RIGHT"
EFFECT_CHAR_DOWN " DOWN"
EFFECT_CHAR_LEFT " LEFT"
EFFECT_HSV_CV "\x00\xff\xff\x40\xff\xff"
EFFECT_CHAR_UP " HSV_CV 00-40"
EFFECT_HSV_CH "\x00\xff\xff\x40\xff\xff" "HSV_CH 00-40"
EFFECT_HSV_AV "\x00\xff\xff\x40\xff\xff" "HSV_AV 00-40"
EFFECT_HSV_AH "\x00\xff\xff\xff\xff\xff" "HSV_AH 00-FF"
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"
EFFECT_HSV "\xa0\xff\xff" "W"
EFFECT_HSV "\x80\xff\xff" "S "
EFFECT_DELAY_FRAMES "\x00\x96"
EFFECT_RGB "\xff\xff\xff"
EFFECT_FRAME_RATE "\x05"
EFFECT_SCROLL_LEFT EFFECT_RGB "\x52\xff\xa3" " FABLAB CHEMNITZ -- KEIN DOENER, KEINE PIZZA, ABER ANDERE NETTE DINGE "*/
};
int demo2;
/*
String StringRead =
EFFECT_FRAME_RATE "\x06"
EFFECT_SCROLL_LEFT EFFECT_RGB "\x52\xff\xa3" "Hallo weLT:";
*/
static uint8_t hue;
int16_t x, y;
uint8_t h;
int UPDATES_PER_SECOND;
void setup()
{
//StringRead.reserve(100);
FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds[0], leds.Size());
FastLED.setBrightness(63);
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(MatriseFontData);
ScrollingMsg.Init(&leds, leds.Width(), ScrollingMsg.FontHeight() + 1, 0, 0);
ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 0xff, 0x00, 0xff);
//ScrollingMsg.SetBackgroundMode(BACKGND_DIMMING, 0x05);
//ScrollingMsg.SetFrameRate(FrameRate);
// currentPalette = RainbowColors_p;
// currentBlending = LINEARBLEND;
}
void loop()
{
h = hue;
if (ScrollingMsg.UpdateText() == -1) {
ScrollingMsg.SetText((unsigned char *)TxtDemo, sizeof(TxtDemo) - 1);
//ScrollingMsg.SetText((unsigned char *) StringRead.c_str(), StringRead.length());
// demo2=40;
}
else {
FastLED.show();
//delay(3);
//FastLED.clear();
}
delay(8);
/* if (Serial.available()) {
if (Serial.available() != 0) {
StringRead = Serial.readString();
}
}
*/
/* if(demo2>=20){
for (x=0; x<leds.Width(); ++x)
{
leds.DrawLine(x, 0, x, leds.Height() - 1, CHSV(h, 255, 255));
h+=16;
}
hue+=4;
FastLED.show();
FastLED.delay(1000/UPDATES_PER_SECOND);
demo2--;
}
*/
}