Components and supplies
1
Arduino Nano R3
1
4 x 8x8 Dot Matrix with MAX7219
Apps and platforms
1
Arduino IDE
Project description
Code
MAX7219 - using Led Control library to scroll the sample text accross 4 8x8 matrixes
arduino
1// Mario's Ideas 2//MAX7219 - using Led Control library to scroll the sample text accross 4 8x8 matrixes 3#include <LedControl.h> 4 5int DIN = 11; 6int CS = 10; 7int CLK = 13; 8LedControl lc=LedControl(DIN, CLK, CS,4); 9 10int position=0; 11 12int Marios_ideas [8] [54] ={ 13 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, 14 {0,1,0,0,0,1,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,0,0,0,1,1,0,0,0,0}, 15 {0,1,1,0,1,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0}, 16 {0,1,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0}, 17 {0,1,0,0,0,1,0,1,1,1,1,0,1,1,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,0,1,0,0,1,0,1,1,1,0,1,1,1,1,0,0,1,1,0,0,0,0}, 18 {0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0}, 19 {0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,1,0,1,1,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0}, 20 {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,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0} 21 }; 22 23 24void setup() { 25 26 for(int i=0;i<4;i++){ 27 lc.shutdown(i,false); 28 lc.setIntensity(i,3); 29 lc.clearDisplay(i); 30 } 31 delay(3000); 32} 33 34void loop() { 35 for (int j=0;j<9;j++){ 36 for (int i=0;i<8;i++){ 37 lc.setLed(0,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54+24]); 38 lc.setLed(1,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54+16]); 39 lc.setLed(2,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54+8]); 40 lc.setLed(3,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54]); 41 } 42 } 43 delay(20); 44 position=position+1; 45}
MAX7219 - using Parola Library to create complex text animations/transition
arduino
1// Mario's Ideas 2//MAX7219 - using Parola Library to create complex text animations/transition 3#include <MD_Parola.h> 4#include <MD_MAX72xx.h> 5 6#define HARDWARE_TYPE MD_MAX72XX::FC16_HW 7#define MAX_DEVICES 4 8#define CLK_PIN 13 9#define DATA_PIN 11 10#define CS_PIN 10 11 12MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); 13 14struct animations 15{ 16 textEffect_t anim_in; // Animation type 17 textEffect_t anim_out;// Animation type 18 const char * textOut; // Text to display 19 uint16_t speed; // Animation speed (multiplier for library default) 20 uint16_t pause; // pause (multiplier for library default) 21 textPosition_t just; 22}; 23 24 25animations animList[] = 26{ 27 { PA_SCROLL_LEFT, PA_SCROLL_LEFT , "Thanks for watching", 4, 0, PA_LEFT }, 28 { PA_SLICE, PA_GROW_DOWN, "LIKE", 1, 2 , PA_CENTER }, 29 { PA_RANDOM, PA_GROW_DOWN, "SHARE", 1, 2 , PA_CENTER}, 30 { PA_SCROLL_LEFT, PA_SCROLL_LEFT ,"Subscribe", 5, 0 ,PA_LEFT}, 31 { PA_BLINDS, PA_GROW_DOWN ,"Patreon", 2, 2 ,PA_CENTER}, 32 { PA_SCROLL_DOWN_LEFT, PA_SCROLL_DOWN_LEFT ,"SEE", 4, 2 ,PA_LEFT}, 33 { PA_SCROLL_UP_RIGHT, PA_SCROLL_UP_RIGHT, "YOU", 4, 2 ,PA_RIGHT}, 34 { PA_SCROLL_DOWN_RIGHT, PA_SCROLL_DOWN_RIGHT, "SOON", 4, 2 , PA_CENTER} 35}; 36 37 38 39void setup() { 40 P.begin(); 41 42 for (uint8_t i=0; i<ARRAY_SIZE(animList); i++) 43 { 44 animList[i].speed *= P.getSpeed(); animList[i].pause *= 500; 45 } 46} 47 48 49void loop() { 50 static uint8_t i = 0; // text effect index 51 52 if (P.displayAnimate())// animates and returns true when an animation is completed 53 { 54 if (i == ARRAY_SIZE(animList))i = 0; // reset loop index 55 56 P.displayText(animList[i].textOut, animList[i].just, animList[i].speed, 57 animList[i].pause, animList[i].anim_in, animList[i].anim_out); 58 delay(1000); 59 i++; // then set up for next text effect 60 } 61} 62
MAX7219 - using Led Control library to display 8x8 bitmap on 4 8x8 matrixes
arduino
1//Mario's Ideas 2//MAX7219 - using Led Control library to display 8x8 bitmap on 4 8x8 matrixes 3#include <LedControl.h> 4 5int DIN = 11; 6int CS = 10; 7int CLK = 13; 8LedControl lc=LedControl(DIN, CLK, CS,4); 9int active_display=0; 10 11//int Cat[8] ={B10001000,B11111000,B10101000,B01110001,B00100001,B01111001,B01111101,B10111110 }; 12byte Apple [8]={B00011000,B00001000,B01110110,B11111111,B11111111,B11111111,B01111010,B00110100}; 13 14void setup() { 15 for(int i=0;i<4;i++){ 16 lc.shutdown(i,false); 17 lc.setIntensity(i,3); 18 lc.clearDisplay(i); 19 } 20 delay(3000); 21 for(int i=0;i<8;i++) lc.setRow(active_display,i,Apple[i]); 22 delay(3000); 23 lc.clearDisplay(0); 24 delay(3000); 25} 26 27void loop(){ 28 29 for(int i=0;i<8;i++) lc.setRow(active_display,i,Apple[i]); 30 delay(3000); 31 lc.clearDisplay(active_display); 32 active_display++; 33 if (active_display==4) active_display=0; 34}
MAX7219 - using Parola Library to create complex text animations/transition
arduino
1// Mario's Ideas 2//MAX7219 - using Parola Library to create complex text animations/transition 3#include <MD_Parola.h> 4#include <MD_MAX72xx.h> 5 6#define HARDWARE_TYPE MD_MAX72XX::FC16_HW 7#define MAX_DEVICES 4 8#define CLK_PIN 13 9#define DATA_PIN 11 10#define CS_PIN 10 11 12MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); 13 14struct animations 15{ 16 textEffect_t anim_in; // Animation type 17 textEffect_t anim_out;// Animation type 18 const char * textOut; // Text to display 19 uint16_t speed; // Animation speed (multiplier for library default) 20 uint16_t pause; // pause (multiplier for library default) 21 textPosition_t just; 22}; 23 24 25animations animList[] = 26{ 27 { PA_SCROLL_LEFT, PA_SCROLL_LEFT , "Thanks for watching", 4, 0, PA_LEFT }, 28 { PA_SLICE, PA_GROW_DOWN, "LIKE", 1, 2 , PA_CENTER }, 29 { PA_RANDOM, PA_GROW_DOWN, "SHARE", 1, 2 , PA_CENTER}, 30 { PA_SCROLL_LEFT, PA_SCROLL_LEFT ,"Subscribe", 5, 0 ,PA_LEFT}, 31 { PA_BLINDS, PA_GROW_DOWN ,"Patreon", 2, 2 ,PA_CENTER}, 32 { PA_SCROLL_DOWN_LEFT, PA_SCROLL_DOWN_LEFT ,"SEE", 4, 2 ,PA_LEFT}, 33 { PA_SCROLL_UP_RIGHT, PA_SCROLL_UP_RIGHT, "YOU", 4, 2 ,PA_RIGHT}, 34 { PA_SCROLL_DOWN_RIGHT, PA_SCROLL_DOWN_RIGHT, "SOON", 4, 2 , PA_CENTER} 35}; 36 37 38 39void setup() { 40 P.begin(); 41 42 for (uint8_t i=0; i<ARRAY_SIZE(animList); i++) 43 { 44 animList[i].speed *= P.getSpeed(); animList[i].pause *= 500; 45 } 46} 47 48 49void loop() { 50 static uint8_t i = 0; // text effect index 51 52 if (P.displayAnimate())// animates and returns true when an animation is completed 53 { 54 if (i == ARRAY_SIZE(animList))i = 0; // reset loop index 55 56 P.displayText(animList[i].textOut, animList[i].just, animList[i].speed, 57 animList[i].pause, animList[i].anim_in, animList[i].anim_out); 58 delay(1000); 59 i++; // then set up for next text effect 60 } 61} 62
MAX7219 - using Led Control library to scroll the sample text accross 4 8x8 matrixes
arduino
1// Mario's Ideas 2//MAX7219 - using Led Control library to scroll the sample text accross 4 8x8 matrixes 3#include <LedControl.h> 4 5int DIN = 11; 6int CS = 10; 7int CLK = 13; 8LedControl lc=LedControl(DIN, CLK, CS,4); 9 10int position=0; 11 12int Marios_ideas [8] [54] ={ 13 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, 14 {0,1,0,0,0,1,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,0,1,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,0,0,0,1,1,0,0,0,0}, 15 {0,1,1,0,1,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0}, 16 {0,1,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,0,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,1,0,0,0,0,0,0}, 17 {0,1,0,0,0,1,0,1,1,1,1,0,1,1,1,0,0,1,0,1,0,0,1,0,0,1,1,0,0,0,0,1,0,1,0,0,1,0,1,1,1,0,1,1,1,1,0,0,1,1,0,0,0,0}, 18 {0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,0,0,0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0}, 19 {0,1,0,0,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,1,0,1,1,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0}, 20 {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,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0} 21 }; 22 23 24void setup() { 25 26 for(int i=0;i<4;i++){ 27 lc.shutdown(i,false); 28 lc.setIntensity(i,3); 29 lc.clearDisplay(i); 30 } 31 delay(3000); 32} 33 34void loop() { 35 for (int j=0;j<9;j++){ 36 for (int i=0;i<8;i++){ 37 lc.setLed(0,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54+24]); 38 lc.setLed(1,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54+16]); 39 lc.setLed(2,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54+8]); 40 lc.setLed(3,j,i,Marios_ideas[j][(i+position)-abs((i+position)/54)*54]); 41 } 42 } 43 delay(20); 44 position=position+1; 45}
Comments
Only logged in users can leave comments