MajicDesigns / MD_MAX72XX

LED Matrix Library
GNU Lesser General Public License v2.1
307 stars 122 forks source link

How can I change HARDWARE_TYPE and MAX_DEVICES from the loop depending on some integer variables. #56

Closed DaradiciLevente closed 1 year ago

DaradiciLevente commented 1 year ago

Hi. I want to make a watch with a dot matrix display, which also has a web interface where I can set various things. Among the settings in the web interface, I want to be able to set the type of hardware and the number of matrices used. How can I change these data in code (in loop) if the display is already initialized. I use a Wemos D1 mini. An image with the web interface: https://i.imgur.com/eqHtoRf.png When I change the hardware type in the web interface, for the hardware type I get an integer variable 1, 2, 3, 4. Depending on these numbers I want to initialize the display with different types of hardware, so that my code can be used on different types of hardware. For Max_Devices from the web interface, I get an integer variable from the web interface, depending on which to set (on the fly) Max_devices from the code. I mention that the display is initialized as follows:

define HARDWARE_TYPE MD_MAX72XX::FC16_HW

define MAX_DEVICES 4

define CLK_PIN 14

define DATA_PIN 13

define CS_PIN 15

MD_Password P = MD_Password(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

MajicDesigns commented 1 year ago

You need to create the MD_MAX72xx object in the code rather (using new) than as a static object (or use the setModuleType() method) and use the parameters you want at that time. Look at the Dynamic_HW example.