Open georg90 opened 9 years ago
I have some code for the "matrix" style on my hdd. I will search for it and commit it to an experimental branch.
Sounds Great - I thought something like this has to be implemented already ;-)
Here is the code I found on my hdd. I think this is not even finished but should be a good starting point. Unfortunately I do not have the time to integrate it :-/. If you add this feature, I would appreciate a pull request :-)
#include "FastLED.h"
#define NUM_LEDS 114
#define DATA_PIN 6
CRGB leds[NUM_LEDS] = {CRGB::Red};
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
Serial.begin(9600);
}
uint8_t shiftInCols[11] = {0,0,0,5,0,0,0,3,0,0,8};
uint16_t matrixCols[11] = {0,0,0,0,0,0,0,0,0,0,0};
void refreshMatrix() {
Serial.println("refresh()");
for(char i=0; i<11; i++) {
matrixCols[i] <<= 1;
if(shiftInCols[i] > 0) {
matrixCols[i] |= 1;
shiftInCols[i]--;
}
else {
if(random(0,6) == 0) {
shiftInCols[i] = random(3,7);
//matrixCols[i] |= 1;
}
}
}
}
uint8_t posToNum(uint8_t col, uint8_t row) {
uint8_t ret = 0;
row = 9 - row;
if((col & 1) != 0) {
// gerade spalten
ret += (9 - row);
} else {
ret += row;
}
ret += (10*col);
return ret;
}
void prepareBuffer() {
Serial.println("prepare()");
for(char col=0; col<11; col++) {
for(char row=0; row<10; row++) {
const uint16_t mask = (1 << row);
uint8_t num = posToNum(col, row);
if(num >= NUM_LEDS) {
num = 0;
}
if((matrixCols[col] & mask) != 0) {
leds[num] = CRGB::Green;
}
else {
leds[num] = CRGB::Black;
}
}
}
}
void loop() {
Serial.println("loop");
refreshMatrix();
prepareBuffer();
FastLED.show();
delay(200);
}
thanks for the snippet! I'll post my results once I get started
this will work without customizing - just edit it to run into the main sketch and you're done.
Hi Georg, i'm interested on your Code. Can you share it please? Thanks a lot for your Help.
I edited your code a little to be able to run without a DCF77, getting an ACK on remote commands and setting the time with the remote.
Any ideas on supporting a "Matrix" style (from the movies)?
I edited your code a little to be able to run without a DCF77, getting an ACK on remote commands and setting the time with the remote. Also I like to get a Matrix style display and "running text".
I found this for Matrix style operation:
Any idea how to edit this to fit the numbering with your setup?
If anybody is interested I can upload the code soon..