informatica:arduino:matrix_led
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
informatica:arduino:matrix_led [2022/10/24 23:28] – jose | informatica:arduino:matrix_led [2024/11/13 20:32] (current) – jose | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== Matrix |
- | Hay varias bibliotecas (que no librerías) | + | |
- | ====== 1. MD_MAX72XX y MD_Parola ====== | + | ^ ESP32 ^ MAX7219 ^ Descripción ^ |
- | https:// | + | | 5V | VCC | Alimentación | |
+ | | GND | GND | Tierra | | ||
+ | | GPIO 23 | DIN | Datos | | ||
+ | | GPIO 18 | CLK | Reloj | | ||
+ | | GPIO 5 | CS | Chip Select (CS/LOAD) | | ||
- | Bibliotecas: | ||
- | {{: | ||
- | |||
- | ^PANEL^ESP32^ | ||
- | |VCC|Vin| | ||
- | |GND|GND| | ||
- | |DIN|GPIO23| | ||
- | |CS|GPIO5| | ||
- | |CLK|GPIO18| | ||
- | |||
- | Texti de plano a pins | ||
- | < | ||
- | #include < | ||
- | #include < | ||
- | #include < | ||
- | |||
- | // Uncomment according to your hardware type | ||
- | #define HARDWARE_TYPE MD_MAX72XX:: | ||
- | //#define HARDWARE_TYPE MD_MAX72XX:: | ||
- | |||
- | // 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, | ||
- | |||
- | void setup() { | ||
- | |||
- | Display.begin(); | ||
- | Display.setIntensity(0); | ||
- | Display.displayClear(); | ||
- | } | ||
- | |||
- | void loop() { | ||
- | Display.setTextAlignment(PA_LEFT); | ||
- | Display.print(" | ||
- | delay(2000); | ||
- | | ||
- | Display.setTextAlignment(PA_CENTER); | ||
- | Display.print(" | ||
- | delay(2000); | ||
- | |||
- | Display.setTextAlignment(PA_RIGHT); | ||
- | Display.print(" | ||
- | delay(2000); | ||
- | |||
- | Display.setTextAlignment(PA_CENTER); | ||
- | Display.setInvert(true); | ||
- | Display.print(" | ||
- | delay(2000); | ||
- | |||
- | Display.setInvert(false); | ||
- | delay(2000); | ||
- | } | ||
- | </ | ||
- | |||
- | ====== 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, | ||
- | Por ejemplo: | ||
- | matrix.drawChar(0, | ||
- | |||
- | < | ||
- | #include < | ||
- | #include < | ||
- | #include < | ||
- | |||
- | const int pinCS = 5; | ||
- | const int pinClk = 18; | ||
- | const int pinDin = 23; | ||
- | |||
- | String cadena = " | ||
- | |||
- | const int numberOfHorizontalDisplays = 4; | ||
- | //const int numberOfHorizontalDisplays = 1; // retirar comentario para una sola matriz | ||
- | const int numberOfVerticalDisplays = 1; | ||
- | Max72xxPanel matrix = Max72xxPanel(pinCS, | ||
- | |||
- | void setup() { | ||
- | |||
- | matrix.setIntensity(7); | ||
- | // | ||
- | matrix.setPosition(0, | ||
- | matrix.setPosition(1, | ||
- | matrix.setPosition(2, | ||
- | matrix.setPosition(3, | ||
- | matrix.setRotation(0, | ||
- | matrix.setRotation(1, | ||
- | matrix.setRotation(2, | ||
- | matrix.setRotation(3, | ||
- | |||
- | |||
- | } | ||
- | |||
- | void loop() { | ||
- | |||
- | matrix.drawChar(0, | ||
- | matrix.write(); | ||
- | } | ||
- | </ | ||
- | |||
- | Para escribir una palabra: | ||
informatica/arduino/matrix_led.1666654130.txt.gz · Last modified: 2022/10/24 23:28 by jose