Feed on
Posts
Comments

Just a small update on the AT Mini Matrix Ctrl which has now been updated to v0.4 that now allows for us to save space to store text without using animations and have the text scroll right to left. Download: AT_Mini_Matrix_Ctrl_v0.4

https://www.youtube.com/watch?v=4Qi4KpzdbCY

#define A 0
#define B 1
#define C 2
...

// Text array
prog_uchar ledLetters[26][8] PROGMEM = {
  {24,8,20,20,20,28,34,119}, // A
  {124,34,34,60,34,34,34,124}, // B
  {30,34,64,64,64,64,34,28}, // C
  ...

I’ve added a text array so we don’t have to store letters as animations.

// 8x16 buffer LEDs for the text scrolling
byte bufferLEDs[8][16] = {
  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
  ...

The text is put on the right of the 16×8 text buffer and then we move the LEDs left to make it scroll.

// LEDs text to scroll array
prog_uchar ledProgramtext[] PROGMEM = {
  H,A,P,P,Y,M,O,T,H,E,R,S,D,A,Y, // 0 - 14
  H,A,P,P,Y,B,I,R,T,H,D,A,Y, // 15 - 27
  M,E,R,R,Y,C,H,R,I,S,T,M,A,S, // 28 - 41
  H,A,P,P,Y,E,A,S,T,E,R, // 42 - 52
};

Here’s where the letters program are stored.

// Move the LEDs in the buffer left by one and move them to the LEDs array
void moveLEDs(void) {
for (byte row = 0; row < 8; row++) { for (byte column = 15; column > 0; column–) {
bufferLEDs[row][15-column] = bufferLEDs[row][15-(column-1)];
}
bufferLEDs[row][15] = 0; // End one is now off
}
for (byte row = 0; row < 8; row++) { for (byte column = 0; column < 8; column++) { LEDs[row][7-column] = bufferLEDs[row][7-column]; } } }[/code] The moving of the LEDs to the left and then updating the main LEDs array [code]// Light up the LEDs when delay time is over if (trigger_delay >= triggers[trigger_location][delay_time]) {

// Check if we play an animation or text
if (triggers[trigger_location][display_type] == 0) {
// Draw animation

}
else {
// Draw text
while (leds_location <= triggers[trigger_location][end_location]) { append_text_Matrix(); // Append the 8x16 matrix with the next animation for (int m = 0; m < 8; m++) { // Move the 8x16 matrix to the left 8 times moveLEDs(); // Light up the LEDs a few times to fill in time for (int i = 0; i < triggers[trigger_location][animation_speed]; i++) { lightLED(); } } } // Clear buffer 8x16 LEDs clearLED(); } [/code] Here's the new part - we append the letter to the right half of the 8x16 buffer, the move the LEDs 8 times (letter length) and light the LEDs after each move left. Part 1
Part 2
Part 3
Part 4
Part 5: Modifying a PIR module

Leave a Reply