Code Monkey home page Code Monkey logo

md_max72xx's People

Contributors

alaingourves avatar ivankravets avatar jojos62 avatar majicdesigns avatar misch2 avatar njh avatar per1234 avatar wellheck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

md_max72xx's Issues

How to revert to old font.

After updating I see the default font has changed. How do I revert to the old font with the updated version ? Thanks.

Library does not control large displays (eg 28 x FC16_HW)

Subject of issue

Sketch/library MD_MAX72xx_Test.ino works perfectly (with ESP-specific SPI pins) on 8 x FC-16 devices. When used on my 1 metre long MAX7219 strip (28 devices) it fails to control the last 6-8 modules (gets progressively worse, the longer the sketch runs for). Powered via a separate 3v3 supply in case this was causing an issue (and the ESP32's onboard 3v3 regulator cannot support this current requirement anyway).

Set up details

Using MD_MAX72XX library version 3.3.0 (taken from library.json).

Running an unchanged example sketch MD_MAX72xx_Test.ino in a Visual Studio Code (PlatformIO) environment with the Arduino framework on an ESP32 Dev Module. Windows 11 Home. FC-16 devices.

Date of issue

11th September 2022.

Notes & evidence

I have tested the 28 device strip using an Arduino UNO and a very simple sketch (not using this library) and it correctly displays/scrolls the entire 28-device length so I believe the hardware is wired up & working correctly.

What is happening: The first 20 approx device (counting from the right) are correctly controlled with text, graphics etc. The remaining device remain either full lit (all LEDs on or off, varies). The graphics seems to run into the devices that are permanently lit.

Video demo (speeded up) here: https://www.dropbox.com/s/eidwwuvr9cvlp7k/MAX7219.mp4?dl=0

Best Regards
Ralph S Bacon

intensity 0 is still too 'intense' ;-)

Hi Marco,

If I use matrix.control(MD_MAX72XX::INTENSITY, 0); to set the intensity to the lowest value, it is still too bright when used for a clock in a bedroom.

How can I 'hack' this to lower the brighness? Since the required intensity value is an uint I can't use negative values or floats, but may be there is an easy way to hack it, before I'm diving in your source code ;-)

I'm using this display: DAOKI MAX7219 Dot led Matrix MCU 8x32 Control LED Display Module Drive for Arduino Raspberry Pi 4 in 1 (Brand: DAOKI)

Thanks a lot!
Gert

Add option to use alternative SPI ports

IMPORTANT

Before submitting this issue
[x ] Have you tried using the latest version of the library?
[ x] Have you checked this has not already been submitted and/or resolved?
[ x] If you are requesting help a better choice may be the Arduino forum

Subject of the issue

Some hardware has more than one SPI port and it would be useful to be able to use these as the SPI interface.

Your Environment

eg, Teensy 4.1

Expected Behaviour

Additional class constructor that takes a reference to the SPI as a parameter. Current SPI would operate by default.

tried it on the ESP8266

thank you for your nice Library and the "daft punk helmet" demo!!!
I did run it on the ESP8266 and it works.

then I tried to add the Wifi & MQTT features that I use in other projects:
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <PubSubClient.h>

and it crashes :-(

did someone had more success with that ?

to be more precise:
I got WiFi connected
MQTT ...connected
and it crashes at:

resetMatrix();

string specular and polarity reverse per char

i try your library in arduino nano,all the exaple sketch look the same:
every single chars is reversed and in specular position.an imagine can explain here is print_text example:

img_20180330_210939

Possible to change font

How is it possible to change the font?
The default seems to be very straight number, I want the numbers more rounded.

How can I configure the LCD5x7_fixed_single font to be used?

Thanks

A small error in the line of example "eyes"

Hi, there is an error in the MD_MAX72xx_Eyes.ino example, in the following line, "eye =" instead of "M ="

//MD_MAX72XX eye = MD_MAX72XX(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

regards.

Name Of the Default Font

What is the name of the default font in this library? Where can I find the ttf file for that?

MAX7219, 1088AS 4 x 8x8 mirrored text

I have a 4 devices 8x8 MAX7219 display block linke below:
https://de.aliexpress.com/item/32955063973.html?spm=a2g0s.9042311.0.0.27424c4dEH9hyR
I'm using an ESP8266, NodeMCU (LOLIN) and the newest 3.1 library of MD_MAX72XX and MD_Parola).
I'm using the Text-Scroll example and it works but the scrolling text is horizontally mirrored.
So each char is flipped 180degree horizontally. so e,r are shown to the left side instead of right side.

Any ideas?
I have tried the different HW models, but it get worse, if I use nay other model:
// PAROLA_HW, ///< Use the Parola style hardware modules.
// GENERIC_HW, ///< Use 'generic' style hardware modules commonly available.
// ICSTATION_HW, ///< Use ICStation style hardware module.
// FC16_HW ///< Use FC-16 style hardware module.

esp32

esp32 dev mod
i get when compiling this warning
libraries\MD_MAX72XX\src/MD_MAX72xx.h:14:2: warning: #warning "ARDUINO SPI interface activated." [-Wcpp]
#warning "ARDUINO SPI interface activated."
I notice also spi is runnning slow. Speed scrolling stays the same. even if i change speed to 25.

My includes are the following.
#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>
#include <elapsedMillis.h>
#include <RTClib.h>
#include <WiFiManager.h>

expected unqualified-id

good evening
sorry for this but am very new to this hobby,
but keep holding this error what am I doing wrong.
again sorry .
greeting Dinand

MD_MAX72xx.h:258:1: error: expected unqualified-id before 'class'

class MD_MAX72XX

^

MD_MAX72xx.h:258:1: error: expected constructor, destructor, or type conversion before 'class'

exit status 1
expected unqualified-id before 'class'

Missing semicolon at end of font structure written by txt2font.c (print statement at line 349)

IMPORTANT

Before submitting this issue
[yes ] Have you tried using the latest version of the library?
[ yes] Have you checked this has not already been submitted and/or resolved?
[ ] If you are requesting help a better choice may be the Arduino forum

Subject of the issue

The text in print statement in line 349 of "Font Builder/src/txt2font.c" is missing the trailing semicolon in the output font array definition. Needs semicolon after closing curly bracket.

Org line:
fprintf(G.fpOut, "}\n\n");
Should be:
fprintf(G.fpOut, "};\n\n");

Your Environment

**Library Version: 3.0.2
**Arduino IDE version: 1.8.8
**Hardware model/type: WeMos D1 R1
**OS and Version: Ubuntu 18.04

Steps to Reproduce

Build any font.h using the supplied example font.txt files. Include resultant font header file in user src. Compiling user src will issue what appears to be unrelated errors -- traceable back to the missing semicolon.

Expected Behaviour

Array definition need to be terminated by a semicolon.

ESP32 Wiring and Pinout for MD_Max72XX and MD_Parola

I could not find a lot of documentation is around wiring an ESP32 with MD_MAX72XX so I thought i will leave this here for anyone trying to figure it out. (This took me a LONG time understand hehe)

I have tested this on my NodeMCU32s (with 38 pins)

To use the hardware SPI - Wire your ESP32 to the following pins

  • CLK_PIN to Pin 13 - VSPI SCK (P18 on the board)
  • DATA_PIN to Pin 11 - VSPI MOSI (P23 on the board)
  • CS_PIN to Pin 15 (This is an arbitrary choice. This is labeled P15 on my board)
  • GND and VCC go their respective pins

ESP32 Pinout for MD_Max72XX
(src: https://www.teachmemicro.com/esp32-max7219-wifi-message-board/)

image

Hope it helps :)

MD_MAX72XX_Message_ESP8266 sketch

IMPORTANT

Before submitting this issue
[X] Have you tried using the latest version of the library?
[X] Have you checked this has not already been submitted and/or resolved?
[ ] If you are requesting help a better choice may be the Arduino forum

Subject of the issue

Describe your issue here.

Your Environment

Library Version: 3.3.0
Arduino IDE version: 1.8.5
Host OS and Version: win7
CPU Hardware model/type: i7-3820
Matrix hardware model/type: [ ] Parola [ ] Generic [ ] ICStation [ ] FC-16 [ ] Custom (describe how wired)

Steps to Reproduce

Enter in browser any symbol beyond 159 (9F) and it is not displayed correctly. It shows the code e.g. %A0 but not the actual symbol.

Expected Behaviour

Show all symbols from code 00 to code FF.

Actual Behaviour

Only symbols from 00 to 9F are displayed. Others, from A0 to FF are not shown (%A0 to %FF on MAX7219).

Code Demonstrating the Issue

Insert your compilable code here (no code snippets).

ESP32 with Robot Eyes Example

IMPORTANT

Before submitting this issue
[X] Have you tried using the latest version of the library?
[X] Have you checked this has not already been submitted and/or resolved?
[maybe] If you are requesting help a better choice may be the Arduino forum

Subject of the issue

Robot Eye example is not compatible with ESP32, when i try to compile the code for ESP32 both in the Arduino IDE and in PlatformIO i get a lot of errors. If i try with arduino board the code compile normaly

Your Environment

3.1.0:
Arduino IDE version: 1.8.21 - PlatformIO Home 2.1.0 · Core 3.6.7
Hardware model/type: ESP32
OS and Version:

Steps to Reproduce

Load example, select Arduino Board, it compiles ok, select esp32 board, see the errors

Expected Behaviour

i think de c++ code should be full functional to all microcontrollers , the other examples works fine

Allow font data to be stored in RAM (ideally loaded from a Stream)

Hi,

Thank you very much for this excellent library.

My client wants to customize the font without recompiling the project.
I searched for a way to load the font data from a binary file on an SD card.
I looked at MD_MAX72xx_font.cpp and saw that the library assumes that the font is in program memory.

Unfortunately, this design prevents customizing the font at runtime.
Could you provide a way to support this scenario?

I wish we could directly pass the File instance to setFont(), but passing a pointer would be a good first step.

Best regards,
Benoit

The Excel Font Generator Tool "copy to clipboard" doesn't work on windows 10. But I found a solution.

IMPORTANT

Before submitting this issue
[] Have you tried using the latest version of the library?
[
] Have you checked this has not already been submitted and/or resolved?
[ ] If you are requesting help a better choice may be the Arduino forum

Subject of the issue

The Excel Font Generator Tool "copy to clipboard" doesn't work on windows 10. But I found a solution.

Your Environment

Library Version:
Arduino IDE version:
Host OS and Version:
CPU Hardware model/type:
Matrix hardware model/type: [ ] Parola [ ] Generic [ ] ICStation [*] FC-16 [ ] Custom (describe how wired)

Steps to Reproduce

It is not with Arduino code, it is about the Excel Font Generator Tool.

Expected Behaviour

It should copy the generated array into clipboard.

Actual Behaviour

It does not copy as obj.PutInClipboard does not work on windows 10.

Code Demonstrating the Issue

MyDataObj.PutInClipboard

ESP8266 and MAX72xx

IMPORTANT

Before submitting this issue
[X ] Have you tried using the latest version of the library?
[X ] Have you checked this has not already been submitted and/or resolved?
[ ] If you are requesting help a better choice may be the Arduino forum

Subject of the issue

AP of the ESP is still active after connection to wireless network.

Your Environment

Library Version:
Arduino IDE version:
Host OS and Version:
CPU Hardware model/type:
Matrix hardware model/type: [ ] Parola [ ] Generic [ ] ICStation [ ] FC-16 [ ] Custom (describe how wired)

Steps to Reproduce

Simply flash the example code.

Expected Behaviour

Connection to wireless network should deactivate AP mode of ESP.

Actual Behaviour

Connection to wireless network is done. AP mode of ESP is active also.

Code Demonstrating the Issue

Insert your compilable code here (no code snippets).

Changing font squirts an integer at the serial port

Currently when switching between fonts triggers a number such as 5 or 7 to be written to the serial port. Could this be disabled as it is causing unwanted traffic? I took a brief look at the source but couldn't find the culprit.

transform with TFLR: in case of even number of devices we miss the swap on centered devices

Subject of the issue

I have a setup with 4 devices.
When applying TFLR transformation, both external devices are swapped (good),
but both internal devices are not swapped.
For example if I display "MAX!", after transformation I get "!AXM" instead of "!XAM"

Analysis

in file MD_MAX72xx_pix.cpp, in method MD_MAX72XX::transform()

    case TFLR: // Transform Flip Left to Right (use the whole field)
    // first reverse the device buffers end for end
    for (uint8_t buf = 0; buf < (endDev - startDev )/2; buf++)

The number of devices should be (endDev - startDev + 1) a nd not (endDev - startDev)
ex: startDev=0 and endDev = 3, there are 4 devices. and (endDev - startDev +1) /2 = 2 swaps should be performed.
Formula is still valid for odd number of devices.

Code Demonstrating the Issue

#include <MD_MAX72xx.h>

#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
#define MAX_DEVICES  4

#define CLK_PIN   13  // or SCK
#define DATA_PIN  11  // or MOSI
#define CS_PIN    10  // or SS

// SPI hardware interface
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

void setup()
{
  mx.begin();
  mx.clear();
}

void loop()
{
  mx.setChar(6, '!');
  mx.setChar(14, 'X');
  mx.setChar(22, 'A');
  mx.setChar(30, 'M');
    delay(2000);
  mx.transform(MD_MAX72XX::TFLR);

  delay(5000);
  mx.transform(MD_MAX72XX::TINV);
  delay(700);
  delay(10000);
}

getPoint was not declared within this scope

image

Your Environment

Library Version: latest today
Arduino IDE version: 1.8.10
Hardware model/type: single generic 8x8

Steps to Reproduce

Put getPoint somewhere in your code. it will not compile anymore

Remove column between characters - Help request

I wish to remove the blank column between characters, instead adding the column to the font table to allow me to create sprite font characters that can be added end to end to create an image.

I have updated the font table to increase the width of the "normal" characters by one, and adding "0," to the end of the line for the blank column, but when I set the CHAR_SPACING constant to 0 it only draws the first character and nothing more on the LED.

Is there any way to get around this to not have the column hard-written?

My Environment

Library Version: MD_MAX72XX 3.2.4
Arduino IDE version: 1.8.13
Hardware model/type: NodeMCU 0.9 with ESP8266
OS and Version: Windows 10

Steps to Reproduce

Using the code from mytechtutor as linked below (HTML edited).
Editing line 48 "const uint8_t CHAR_SPACING = 1;" to "const uint8_t CHAR_SPACING = 0;"

Expected Behaviour

Column width between characters = 0 (so none).

Actual Behaviour

script displays only the first character of the string ("C" in the code below)

Code Demonstrating the Issue

#include <ESP8266WiFi.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

#define PRINT_CALLBACK  0
#define DEBUG 1
#define LED_HEARTBEAT 1

#if DEBUG
#define PRINT(s, v) { Serial.print(F(s)); Serial.print(v); }
#define PRINTS(s)   { Serial.print(F(s)); }
#else
#define PRINT(s, v)
#define PRINTS(s)
#endif


#if LED_HEARTBEAT
#define HB_LED  D0
#define HB_LED_TIME 500 // in milliseconds
#endif

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define MAX_DEVICES 4

#define CLK_PIN   D5 // or SCK
#define DATA_PIN  D7 // or MOSI
#define CS_PIN    D8 // or SS

// SPI hardware interface
//MD_MAX72XX mx = MD_MAX72XX(CS_PIN, MAX_DEVICES);
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW  //edit this as per your LED matrix hardware type
MD_MAX72XX mx = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Arbitrary pins
//MD_MAX72XX mx = MD_MAX72XX(DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

// WiFi login parameters - network name and password
const char* ssid = "SSID_REMOVED";                   // edit your wifi SSID here
const char* password = "SSID_PASS_REMOVED";            // edit your wifi password here

// WiFi Server object and parameters
WiFiServer server(80);

// Global message buffers shared by Wifi and Scrolling functions
const uint8_t MESG_SIZE = 255;
const uint8_t CHAR_SPACING = 1;
const uint8_t SCROLL_DELAY = 75;

char curMessage[MESG_SIZE];
char newMessage[MESG_SIZE];
bool newMessageAvailable = false;

char WebResponse[] = "HTTP/1.1 200 OK\nContent-Type: text/html\n\n";

char WebPage[] =
"<!DOCTYPE html>\n" \
"<html>\n" \
"<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n" \
"<title>ESP8266 AND MAX7219 LED Matrix Controller</title>\n" \
"<style>\n" \
"html, body \n" \ 
"{\n" \
"font-family: Helvetica; \n" \
"display: block;\n" \ 
"margin: 0px auto;\n" \ 
"text-align: center;\n" \
"background-color: #cad9c5;\n" \
"}\n" \
"#container \n" \
"{\n" \
"width: 100%;\n" \
"height: 100%;\n" \
"margin-left: 5px;\n" \
"margin-top: 20px;\n" \
"border: solid 2px;\n" \
"padding: 10px;\n" \
"background-color: #2dfa53;\n" \
"}\n" \          
"</style>"\
"<script>\n" \
"strLine = \"\";\n" \
"function SendText()\n" \
"{\n" \
"  nocache = \"/&nocache=\" + Math.random() * 1000000;\n" \
"  var request = new XMLHttpRequest();\n" \
"  strLine = \"&MSG=\" + document.getElementById(\"txt_form\").Message.value;\n" \
"  request.open(\"GET\", strLine + nocache, false);\n" \
"  request.send(null);\n" \
"}\n" \
"</script>\n" \
"</head>\n" \
"<body>\n" \
"<H1><b>ESP8266 and MAX7219 LED Matrix WiFi Control</b></H1>\n" \ 

"<div id=\"container\">\n" \
"<form id=\"txt_form\" name=\"frmText\">\n" \
"<label>Message:<input type=\"text\" name=\"Message\" maxlength=\"255\" id=\"Message\"></label>\n" \
"</form>\n" \
"<input type=\"submit\" value=\"Send Text\" onclick=\"SendText()\">\n" \
"<p>\n" \
"<b>For custom characters enter the following strings:</b><br>\n" \ 
"Try: %96 XMAS : %97 BR : %9A WiFi : %9B YT : %9C FB : %9D Twitter : %9E Insta : %9F Camera</br></br>\n" \
"</p>\n" \
"<h3>Custom defined characters</h3>\n" \
"<table align=center>\n" \
"<tr><th>Code to type</th><th>Symbol to appear</th><tr>\n" \ 
"<tr><td><b>%96</b></td><td>Xmas Tree</td></tr>\n" \ 
"<tr><td><b>%9A</b></td><td>WiFi</td></tr>\n" \ 
"<tr><td><b>%9B</b></td><td>YouTube</td></tr>\n" \ 
"<tr><td><b>%9C</b></td><td>Facebook</td></tr>\n" \ 
"<tr><td><b>%9D</b></td><td>Twitter</td></tr>\n" \ 
"<tr><td><b>%9E</b></td><td>Instagram</td></tr>\n" \ 
"<tr><td><b>%9F</b></td><td>Camera</td></tr>\n" \ 
"</table>\n" \
"</div>\n" \
"<script>\n"
"   var url_string = window.location.href; //window.location.href\n"
"    var url = new URL(url_string);\n"
"    var c = url.searchParams.get(\"Message\");\n"
"    document.getElementById(\"Message\").value = c;\n"
"</script>\n" \
"</body>\n" \
"</html>";


char *err2Str(wl_status_t code)
{
  switch (code)
  {
  case WL_IDLE_STATUS:    return("IDLE");           break; // WiFi is in process of changing between statuses
  case WL_NO_SSID_AVAIL:  return("NO_SSID_AVAIL");  break; // case configured SSID cannot be reached
  case WL_CONNECTED:      return("CONNECTED");      break; // successful connection is established
  case WL_CONNECT_FAILED: return("CONNECT_FAILED"); break; // password is incorrect
  case WL_DISCONNECTED:   return("CONNECT_FAILED"); break; // module is not configured in station mode
  default: return("??");
  }
}

uint8_t htoi(char c)
{
  c = toupper(c);
  if ((c >= '0') && (c <= '9')) return(c - '0');
  if ((c >= 'A') && (c <= 'F')) return(c - 'A' + 0xa);
  return(0);
}

boolean getText(char *szMesg, char *psz, uint8_t len)
{
  boolean isValid = false;  // text received flag
  char *pStart, *pEnd;      // pointer to start and end of text

  // get pointer to the beginning of the text
  pStart = strstr(szMesg, "/&MSG=");

  if (pStart != NULL)
  {
    pStart += 6;  // skip to start of data
    pEnd = strstr(pStart, "/&");

    if (pEnd != NULL)
    {
      while (pStart != pEnd)
      {
        if ((*pStart == '%') && isdigit(*(pStart+1)))
        {
          // replace %xx hex code with the ASCII character
          char c = 0;
          pStart++;
          c += (htoi(*pStart++) << 4);
          c += htoi(*pStart++);
          *psz++ = c;
        }
        else
          *psz++ = *pStart++;
      }

      *psz = '\0'; // terminate the string
      isValid = true;
    }
  }

  return(isValid);
}

void handleWiFi(void)
{
  static enum { S_IDLE, S_WAIT_CONN, S_READ, S_EXTRACT, S_RESPONSE, S_DISCONN } state = S_IDLE;
  static char szBuf[1024];
  static uint16_t idxBuf = 0;
  static WiFiClient client;
  static uint32_t timeStart;

  switch (state)
  {
  case S_IDLE:   // initialise
    PRINTS("\nS_IDLE");
    idxBuf = 0;
    state = S_WAIT_CONN;
    break;

  case S_WAIT_CONN:   // waiting for connection
    {
      client = server.available();
      if (!client) break;
      if (!client.connected()) break;

#if DEBUG
      char szTxt[20];
      sprintf(szTxt, "%03d:%03d:%03d:%03d", client.remoteIP()[0], client.remoteIP()[1], client.remoteIP()[2], client.remoteIP()[3]);
      PRINT("\nNew client @ ", szTxt);
#endif

      timeStart = millis();
      state = S_READ;
    }
    break;

  case S_READ: // get the first line of data
    PRINTS("\nS_READ");
    while (client.available())
    {
      char c = client.read();
      if ((c == '\r') || (c == '\n'))
      {
        szBuf[idxBuf] = '\0';
        client.flush();
        PRINT("\nRecv: ", szBuf);
        state = S_EXTRACT;
      }
      else
        szBuf[idxBuf++] = (char)c;
    }
    if (millis() - timeStart > 1000)
    {
      PRINTS("\nWait timeout");
      state = S_DISCONN;
    }
    break;


  case S_EXTRACT: // extract data
    PRINTS("\nS_EXTRACT");
    // Extract the string from the message if there is one
    newMessageAvailable = getText(szBuf, newMessage, MESG_SIZE);
    PRINT("\nNew Msg: ", newMessage);
    state = S_RESPONSE;
    break;

  case S_RESPONSE: // send the response to the client
    PRINTS("\nS_RESPONSE");
    // Return the response to the client (web page)
    client.print(WebResponse);
    client.print(WebPage);
    state = S_DISCONN;
    break;

  case S_DISCONN: // disconnect client
    PRINTS("\nS_DISCONN");
    client.flush();
    client.stop();
    state = S_IDLE;
    break;

  default:  state = S_IDLE;
  }
}

void scrollDataSink(uint8_t dev, MD_MAX72XX::transformType_t t, uint8_t col)
// Callback function for data that is being scrolled off the display
{
#if PRINT_CALLBACK
  Serial.print("\n cb ");
  Serial.print(dev);
  Serial.print(' ');
  Serial.print(t);
  Serial.print(' ');
  Serial.println(col);
#endif
}

uint8_t scrollDataSource(uint8_t dev, MD_MAX72XX::transformType_t t)
// Callback function for data that is required for scrolling into the display
{
  static enum { S_IDLE, S_NEXT_CHAR, S_SHOW_CHAR, S_SHOW_SPACE } state = S_IDLE;
  static char   *p;
  static uint16_t curLen, showLen;
  static uint8_t  cBuf[8];
  uint8_t colData = 0;

  // finite state machine to control what we do on the callback
  switch (state)
  {
  case S_IDLE: // reset the message pointer and check for new message to load
    PRINTS("\nS_IDLE");
    p = curMessage;      // reset the pointer to start of message
    if (newMessageAvailable)  // there is a new message waiting
    {
      strcpy(curMessage, newMessage); // copy it in
      newMessageAvailable = false;
    }
    state = S_NEXT_CHAR;
    break;

  case S_NEXT_CHAR: // Load the next character from the font table
    PRINTS("\nS_NEXT_CHAR");
    if (*p == '\0')
      state = S_IDLE;
    else
    {
      showLen = mx.getChar(*p++, sizeof(cBuf) / sizeof(cBuf[0]), cBuf);
      curLen = 0;
      state = S_SHOW_CHAR;
    }
    break;

  case S_SHOW_CHAR: // display the next part of the character
    PRINTS("\nS_SHOW_CHAR");
    colData = cBuf[curLen++];
    if (curLen < showLen)
      break;

    // set up the inter character spacing
    showLen = (*p != '\0' ? CHAR_SPACING : (MAX_DEVICES*COL_SIZE)/2);
    curLen = 0;
    state = S_SHOW_SPACE;
    // fall through

  case S_SHOW_SPACE:  // display inter-character spacing (blank column)
    PRINT("\nS_ICSPACE: ", curLen);
    PRINT("/", showLen);
    curLen++;
    if (curLen == showLen)
      state = S_NEXT_CHAR;
    break;

  default:
    state = S_IDLE;
  }

  return(colData);
}

void scrollText(void)
{
  static uint32_t prevTime = 0;

  // Is it time to scroll the text?
  if (millis() - prevTime >= SCROLL_DELAY)
  {
    mx.transform(MD_MAX72XX::TSL);  // scroll along - the callback will load all the data
    prevTime = millis();      // starting point for next time
  }
}

void setup()
{
#if DEBUG
  Serial.begin(115200);
  PRINTS("\n[MD_MAX72XX WiFi Message Display]\nType a message for the scrolling display from your internet browser");
#endif

#if LED_HEARTBEAT
  pinMode(HB_LED, OUTPUT);
  digitalWrite(HB_LED, LOW);
#endif

  // Display initialisation
  mx.begin();
  mx.setShiftDataInCallback(scrollDataSource);
  mx.setShiftDataOutCallback(scrollDataSink);

  curMessage[0] = newMessage[0] = '\0';

  // Connect to and initialise WiFi network
  PRINT("\nConnecting to ", ssid);

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED)
  {
    PRINT("\n", err2Str(WiFi.status()));
    delay(500);
  }
  PRINTS("\nWiFi connected");

  // Start the server
  server.begin();
  PRINTS("\nServer started");

  // Set up first message as the IP address
  sprintf(curMessage, "Connected to \x9A %s  @ IP:%03d:%03d:%03d:%03d", ssid, WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], WiFi.localIP()[3]);
  PRINT("\nAssigned IP ", curMessage);
}

void loop()
{
#if LED_HEARTBEAT
  static uint32_t timeLast = 0;

  if (millis() - timeLast >= HB_LED_TIME)
  {
    digitalWrite(HB_LED, digitalRead(HB_LED) == LOW ? HIGH : LOW);
    timeLast = millis();
  }
#endif

  handleWiFi();
  scrollText();
}

Question about scan limit

This is a question rather then a bug report. Feel free to delete/close if you feel like this is not the place.

I have a led matrix with 4 columns (DIG0-DIG1) and 8 rows. I'm trying to disable the unused 4 columns however I'm not sure what I should set SCANLIMIT to as the maximum number it can have looks like is 7 thus making me feel that the number does not correlate directly with the number of digits/columns that one wants to have enabled.

Any pointer would be appreciated. Thanks.

Non-sequential rows/columns

IMPORTANT

Before submitting this issue
[x] Have you tried using the latest version of the library?
[x] Have you checked this has not already been submitted and/or resolved?
[x] If you are requesting help a better choice may be the Arduino forum

Subject of the issue

I found a handful of surplus 8x8 LED modules in my stuff, and designed a MAX7219 board to drive them. I didn't pay much attention to the row/col ordering because in other LED projects I've used it's simple enough to change that mapping.

I can't seem to figure out how to change that mapping for MD_MAX72XX. I have this matrix that I want to drive with Parola:

      | Dig-3 | Dig-6 | Dig-2 | Dig-1 | Dig-7 | Dig-5 | Dig-4 | Dig-0
SEG-B |
SEG-F |
SEG-G |
SEG-D |
SEG-E |
SEG-C |
SEG-A |
SEG-DP |

How can I define that matrix in MD_MAX72XX?

Your Environment

Library Version: Latest downloaded by Arduino today
Arduino IDE version: 2.0
Host OS and Version: KDE Plasma (Linux 5.19.0)
CPU Hardware model/type: Teensy 2.0++
Matrix hardware model/type: [ ] Parola [ ] Generic [ ] ICStation [ ] FC-16 [x] Custom (describe how wired)

Steps to Reproduce

Explain how to reproduce this issue. Please provide working code below to demonstrate the issue.

Expected Behaviour

Explain what should happen.

Actual Behaviour

Explain what happens instead. Provide log messages if relevant.

Code Demonstrating the Issue

This is how I mapped out the rows/cols

#include <MD_MAX72xx.h>
#include <SPI.h>

#define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
#define MAX_DEVICES 1
#define CS_PIN 20
#define DATA_PIN 22
#define CLK_PIN 21
MD_MAX72XX myRawDisplay = MD_MAX72XX(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);

void setup() {
  Serial.begin(57600);
  Serial.print("Starting test...\n");
  myRawDisplay.begin();
}

void loop() {
  for (int x=0; x < 8; x++) {
    for (int y=0; y < 8; y++) {
      Serial.print("Turning on row:");
      Serial.print(x, DEC);
      Serial.print(" col:");
      Serial.print(y, DEC);
      Serial.print("\n");
      myRawDisplay.setPoint(y, x, true);
      while(Serial.available() == 0) {
      }
      int mydata = Serial.read();
      myRawDisplay.setPoint(y, x, false);
    }
  }
}

Corruption in scrolled text example

Scrolling text can leave garbage in-between characters. This is due to the code here:

    for (uint8_t i=0; i<=charWidth; i++)
    {
      mx.transform(MD_MAX72XX::TSL);
      if (i < charWidth)
        mx.setColumn(0, cBuf[i]);
      delay(DELAYTIME);
    }

The correct code should be like this (we need to zero out the row explicitly):

    for (uint8_t i=0; i<=charWidth; i++)
    {
      mx.transform(MD_MAX72XX::TSL);
      mx.setColumn(0, (i < charWidth) ? cBuf[i] : 0);
      delay(DELAYTIME);
    }

Thanks for a great library!

italian char problem

i try to modify the library to use some italian chars like 'è' or 'à' or 'ù'...
i found that in the library is already present in MD_MAX72xx_font.cpp
but apparently in the wrong place:
with serial bluetooth adapter i acqwuire the string to print on the display, but in corresponding of chars there is an error:
if i put 'è' i obtain '-¿', if i replace this on line 336:
5, 0x38, 0x54, 0x54, 0x55, 0x59, // 168 - 'Inverted ?
with this (contasined in line 298):
5, 0x38, 0x54, 0x54, 0x55, 0x59, // 130 - 'e acute'
it's look like '-è'
there is another way to correct that?

Raspberry Pico Support please

IMPORTANT

Before submitting this issue
[X] Have you tried using the latest version of the library?
[X] Have you checked this has not already been submitted and/or resolved?
[ ] If you are requesting help a better choice may be the Arduino forum

Subject of the issue

Error When used on Raspberry Pico

Your Environment

Library Version: Latest
Arduino IDE version: Any
Host OS and Version: Win 11
CPU Hardware model/type:
Matrix hardware model/type: [ ] Parola [ ] Generic [ ] ICStation [X ] FC-16 [ ] Custom (describe how wired)

Steps to Reproduce

Explain how to reproduce this issue. Please provide working code below to demonstrate the issue.
Upload any code that works on Arduino uno/nano it will not work on Pico

Expected Behaviour

Explain what should happen.
Load Example hello code, Hello should display

Actual Behaviour

Explain what happens instead. Provide log messages if relevant.
Just get a few LED flickering very fast on top or bottom line in center

Code Demonstrating the Issue

Insert your compilable code here (no code snippets).
````// Program to demonstrate the MD_Parola library
//
// Simplest program that does something useful - Hello World!
//
// MD_MAX72XX library can be found at https://github.com/MajicDesigns/MD_MAX72XX
//

#include <MD_Parola.h>
#include <MD_MAX72xx.h>
#include <SPI.h>

// Define the number of devices we have in the chain and the hardware interface
// NOTE: These pin numbers will probably not work with your hardware and may
// need to be adapted
#define HARDWARE_TYPE MD_MAX72XX::PAROLA_HW
#define MAX_DEVICES 11

#define CLK_PIN   18
#define DATA_PIN  19
#define CS_PIN    7

// Hardware SPI connection
MD_Parola P = MD_Parola(HARDWARE_TYPE, CS_PIN, MAX_DEVICES);
// Arbitrary output pins
// MD_Parola P = MD_Parola(HARDWARE_TYPE, DATA_PIN, CLK_PIN, CS_PIN, MAX_DEVICES);

void setup(void)
{
  P.begin();
}

void loop(void)
{
  if (P.displayAnimate())
    P.displayText("Hello", PA_CENTER, P.getSpeed(), P.getPause(), PA_SCROLL_DOWN, PA_SCROLL_UP);

}
```

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

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);

Under docs you need to rename the files so they do not start with an "_" because the Arduino IDE won't read the files.

IMPORTANT

Before submitting this issue
[ ] Have you tried using the latest version of the library?
[ ] Have you checked this has not already been submitted and/or resolved?
[ ] If you are requesting help a better choice may be the Arduino forum

Subject of the issue

Describe your issue here.

Your Environment

Library Version:
Arduino IDE version:
Hardware model/type:
OS and Version:

Steps to Reproduce

Explain how to reproduce this issue. Please provide working code below to demonstrate the issue.

Expected Behaviour

Explain what should happen.

Actual Behaviour

Explain what happens instead. Provide log messages if relevant.

Code Demonstrating the Issue

Insert your code here.

Rx/Tx Serial input for control of LED Banner

Hello MD Parola, I have been using your MD_MAX72xx Message Serial successfully to control an LED banner from the Arduino suite Serial Monitor, i'm wanting to do the same via the Rx/Tx pins on the board. I have RS-232 converted to TTL and would like the LED banner to display the ASCii characters I send via my PLC controller to RS-232 output. I found the below link on the Arduino side and suspect I have to include the same serial library, specify which serial port to use in your code, and then maybe make some other minor modifications.

https://www.arduino.cc/en/Reference/SoftwareSerialRead

Do you have any suggestions on how to proceed or do you have any examples you could share?

Printing Swe characters

Apologies before I start writing this question. Might sound trivial but I am looking a simple way to print öäåÖÄÅ (swedish) characters on 8x8 LED (MAX7219) .

Let's say if I take MD_MAX72XX_PrintText from examples and replace output text with this

char message[BUF_SIZE] = {"HelloÅ"};

then I get a "Hello |-" instead of HelloÅ

How in an easy can this be achieved ?

Surely I am not the first one who have asked as these characters are common in many european languages. But I cannot find a readily available solution.

Issue when using >32 devices

I have a string of 40 MAX7219 controlled matrices which I'm attempting to control using an Arduino Mega 2560 R3 and the MD_MAX72XX library.

I've used the print_test sample code to get my matrices to display a string of characters ("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"). Everything works correctly as I change MAX_DEVICES to values in the range 1-32 (as expected, the sequence repeats when the physical string of matrices is longer than MAX_DEVICES):
dsc_1017

However, when I change MAX_DEVICES to a value >32, the subsequent matrices are not controlled.

MAX_DEVICES = 33:
dsc_1018

MAX_DEVICES = 36:

dsc_1019

MAX_DEVICES = 40:

dsc_1020

MD_MAX72xx_Message_Serial example does not load characters > 127

Subject of the issue

MD_MAX72xx_Message_Serial example does not load characters > 127

Steps to Reproduce

Include the degree symbol (\220) in a message string.

Expected Behaviour

Degree character scrolled out

Actual Behaviour

Garbage bits scroll out

This is due to line 98 in scrollDataSource. char *p loads a negative value and indexes the font table incorrectly. I fixed it locally by casting (uint8_t)*p++.

Custom Sprites

Does anyone know how to display custom sprites on the MAX7219 using the MD_MAX72xx and MD_PAROLA libraries?

Sources for custom max7219 display boards ?

Just a quick question if you know how to get custom version of the popular 32x8 dot matrix boards powered with 4 max7219 chips. They are so cheap on amazon but I want one with a built in esp32 or at least with straight headers instead of 90 degree headers. Any ideas ?

Library doesn't compile for Arduino Nano 33 BLE

IMPORTANT

Before submitting this issue
[x] Have you tried using the latest version of the library?
[x] Have you checked this has not already been submitted and/or resolved?
[x] If you are requesting help a better choice may be the Arduino forum

Subject of the issue

Trying to compile MD_MAX72xx for Nano 33 BLE gives errors that SPI is not defined. This is because #30 introduces compatibility with mbed. The Arduino Nano 33 BLE also runs mbed, and this causes the__MBED__ macro to be defined.

A possible solution to this would be to check for #ifndef Arduino_h and only check for elseif __MBED__. Although I'm not experienced with arduino and I'm not sure this would be bad practice.

When removing the __MBED__ directives, I succeed to compile, but I haven't deployed it yet on a target.

I'm happy to work on a solution, but wanted to check what you think would be a good way forward?

Your Environment

Library Version: 3.2.4
Arduino IDE version: 1.8.13
Hardware model/type: Arduino Nano 33 BLE
OS and Version: Mac OS Big Sur

Steps to Reproduce

Compile the below block for Arduino Nano 33 BLE

Expected Behaviour

Should just compile.

Actual Behaviour

Gives following error

Arduino: 1.8.13 (Mac OS X), Board: "Arduino Nano 33 BLE"

In file included from /var/folders/b0/57dvvvtn5l93d5m84k7vfrzh0000gn/T/arduino_modified_sketch_871210/BareMinimum.ino:1:0:
/Users/tim/Documents/Arduino/libraries/MD_MAX72XX/src/MD_MAX72xx.h:998:3: error: 'SPI' does not name a type; did you mean 'SPIS'?
   SPI   _spi;           // Mbed SPI object
   ^~~
   SPIS
/Users/tim/Documents/Arduino/libraries/MD_MAX72XX/src/MD_MAX72xx.h:999:3: error: 'DigitalOut' does not name a type; did you mean 'digitalRead'?
   DigitalOut _cs;
   ^~~~~~~~~~
   digitalRead
exit status 1
Error compiling for board Arduino Nano 33 BLE.

Code Demonstrating the Issue

#include <MD_MAX72xx.h>
#include <SPI.h>

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

FC-16 boards and 1088B matrices

I don't understand how to use 1088B LED matrices with FC-16 boards with this library.
What do I need to change in the library?

When using the 1088A, I have to insert the LED matrices upside down.

Mirrored text

Hey there @MajicDesigns,

When testing the example scripts, the text displays in a wrong order.
When googling for this issue i found that you have to change
#define USE_PAROLA_HW 1
To
#define USE_PAROLA_HW 0
but the problem is that the line you have to edit is not present in the file. (MD_MAX72xx.h).
How do i fix this? or is there something im missing?
Thanks in advance :)

003random,

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.