User Tools

Site Tools


informatica:arduino:matrix_led

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
informatica:arduino:matrix_led [2022/10/24 23:50] joseinformatica:arduino:matrix_led [2024/11/13 20:32] (current) jose
Line 1: Line 1:
-====== Panel Matrix led ====== +====== Matrix panel led MAX7219 ======
-Hay varias bibliotecas (que no librerías)+
  
-====== 1. MD_MAX72XX y MD_Parola ====== +^ ESP32 ^ MAX7219 ^ Descripción ^ 
-https://microcontrollerslab.com/led-dot-matrix-display-esp32-max7219/+| 5V | VCC | Alimentación | 
 +| GND | GND | Tierra | 
 +| GPIO 23 | DIN | Datos | 
 +| GPIO 18 | CLK | Reloj | 
 +| GPIO 5 | CS | Chip Select (CS/LOAD) |
  
-Bibliotecas: MD_MAX72XX by MajicDesigns and MD_Parola de MajicDesigns 
  
-{{:informatica:arduino:ejemplo_1.png|}} 
- 
-^PANEL^ESP32^ 
-|VCC|Vin| 
-|GND|GND| 
-|DIN|GPIO23| 
-|CS|GPIO5| 
-|CLK|GPIO18| 
- 
-Texti de plano a pins 
-<code> 
-#include <MD_Parola.h> 
-#include <MD_MAX72xx.h> 
-#include <SPI.h> 
- 
-// Uncomment according to your hardware type 
-#define HARDWARE_TYPE MD_MAX72XX::FC16_HW 
-//#define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW 
- 
-// Defining size, and output pins 
-#define MAX_DEVICES 4 
-#define DATA_PIN 23 
-#define CS_PIN 5 
-#define CLK_PIN 18 
- 
- 
-MD_Parola Display = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES); 
- 
-void setup() { 
-  
-  Display.begin(); 
-  Display.setIntensity(0); 
-  Display.displayClear(); 
-} 
- 
-void loop() { 
-  Display.setTextAlignment(PA_LEFT); 
-  Display.print("ESP32"); 
-  delay(2000); 
-   
-  Display.setTextAlignment(PA_CENTER); 
-  Display.print("ESP32"); 
-  delay(2000); 
- 
-  Display.setTextAlignment(PA_RIGHT); 
-  Display.print("ESP32"); 
-  delay(2000); 
- 
-  Display.setTextAlignment(PA_CENTER); 
-  Display.setInvert(true); 
-  Display.print("ESP32"); 
-  delay(2000); 
- 
-  Display.setInvert(false); 
-  delay(2000); 
-} 
-</code> 
- 
-====== 2. Max72xxPanel y SPI ====== 
-Con esta biblioteca (que no librería) podemos definir en que posición sale cada carácter. Por ejemplo, si hacemos una secuencia de números, el 1 es mas estrecho que el 2 
- 
-  matrix.drawChar(x,y,char,color,bg,size); 
-Por ejemplo:                 
-  matrix.drawChar(0, 1, cadena[2], HIGH, LOW, 1); 
- 
-<code> 
-#include <SPI.h> 
-#include <Adafruit_GFX.h> 
-#include <Max72xxPanel.h> 
- 
-const int pinCS = 5; 
-const int pinClk = 18; 
-const int pinDin = 23; 
- 
-String cadena = "ESP32"; 
- 
-const int numberOfHorizontalDisplays = 4; 
-//const int numberOfHorizontalDisplays = 1; // retirar comentario para una sola matriz  
-const int numberOfVerticalDisplays = 1; 
-Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays); 
- 
-void setup() { 
- 
-  matrix.setIntensity(7); // Use a value between 0 and 15 for brightness 
-   // 
-  matrix.setPosition(0, 0, 0); // The first display is at <0, 0> 
-  matrix.setPosition(1, 1, 0); // The second display is at <1, 0> 
-  matrix.setPosition(2, 2, 0); // The third display is at <2, 0> 
-  matrix.setPosition(3, 3, 0); // And the last display is at <3, 0> 
-  matrix.setRotation(0, 1);    // Display is position upside down 
-  matrix.setRotation(1, 1);    // Display is position upside down 
-  matrix.setRotation(2, 1);    // Display is position upside down 
-  matrix.setRotation(3, 1);    // Display is position upside down 
- 
- 
-} 
- 
-void loop() { 
- 
-  matrix.drawChar(0, 1, cadena[3], HIGH, LOW, 1); 
-  matrix.write(); 
-} 
-</code> 
- 
-Para escribir una palabra: 
-Justificado a la izquierda 
-<code> 
-#include <SPI.h> 
-#include <Adafruit_GFX.h> 
-#include <Max72xxPanel.h> 
- 
-//Vcc - Vcc 
-//Gnd - Gnd 
-//Din - Mosi (Pin 11) 
-//Cs  - SS (Pin 10) 
-//Clk - Sck (Pin 13) 
- 
-const int pinCS = 5; 
-const int numberOfHorizontalDisplays = 4; 
-const int numberOfVerticalDisplays = 1; 
- 
-Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays); 
- 
-String tape = "Jur";  //text 
- 
-const int wait = 1000; // In milliseconds 
- 
-const int spacer = 1; 
-const int width = 5 + spacer; // The font width is 5 pixels 
- 
-void setup() { 
-   matrix.setIntensity(7); // Use a value between 0 and 15 for brightness 
- 
-   matrix.setRotation(0, 1);    // Display is position upside down 
-   matrix.setRotation(1, 1);    // Display is position upside down 
-   matrix.setRotation(2, 1);    // Display is position upside down 
-   matrix.setRotation(3, 1);    // Display is position upside down 
-} 
- 
-void loop() { 
-  for (int i = 0; i < tape.length(); i++) { 
-    matrix.drawChar(i*width, 1, tape[i], HIGH, LOW, 1); 
-    matrix.write(); // Send bitmap to display 
-  } 
-  delay(wait); 
- 
-  matrix.fillScreen(0); 
-  matrix.write(); 
-  delay(wait); 
- 
-} 
-</code> 
-Texto con Scroll: 
-<code> 
-#include <SPI.h> 
-#include <Adafruit_GFX.h> 
-#include <Max72xxPanel.h> 
- 
-//Vcc - Vcc 
-//Gnd - Gnd 
-//Din - Mosi (Pin 11) 
-//Cs  - SS (Pin 10) 
-//Clk - Sck (Pin 13) 
- 
-const int pinCS = 5; 
-const int numberOfHorizontalDisplays = 4; 
-const int numberOfVerticalDisplays = 1; 
- 
-Max72xxPanel matrix = Max72xxPanel(pinCS, numberOfHorizontalDisplays, numberOfVerticalDisplays); 
- 
-String tape = "Texto con Scroll";  //text 
- 
-const int wait = 100; // In milliseconds 
- 
-const int spacer = 1; 
-const int width = 5 + spacer; // The font width is 5 pixels 
- 
-void setup() { 
-   matrix.setIntensity(7); // Use a value between 0 and 15 for brightness 
- 
-   matrix.setRotation(0, 1);    // Display is position upside down 
-   matrix.setRotation(1, 1);    // Display is position upside down 
-   matrix.setRotation(2, 1);    // Display is position upside down 
-   matrix.setRotation(3, 1);    // Display is position upside down 
-} 
- 
-void loop() { 
-   for (int i = 0; i < width * tape.length() + matrix.width() - 1 - spacer; i++) { 
- 
-      matrix.fillScreen(LOW); 
- 
-      int letter = i / width; 
-      int x = (matrix.width() - 1) - i % width; 
-      int y = (matrix.height() - 8) / 2; // center the text vertically 
- 
-      while (x + width - spacer >= 0 && letter >= 0) { 
-         if (letter < tape.length()) { 
-            matrix.drawChar(x, y, tape[letter], HIGH, LOW, 1); 
-         } 
- 
-         letter--; 
-         x -= width; 
-      } 
-      matrix.write(); // Send bitmap to display 
- 
-      delay(wait); 
-   } 
-} 
-</code> 
  
informatica/arduino/matrix_led.1666655446.txt.gz · Last modified: 2022/10/24 23:50 by jose