HCMAX7219 - LED driver library

Useful guides, libraries, and example sketches to support our Arduino based products.
DavidP
Posts: 3
Joined: Tue Mar 13, 2018 5:30 pm

Re: HCMAX7219 - LED driver library

Post by DavidP » Tue Mar 13, 2018 5:39 pm

Hello,

I am hoping to use two MAX7219 8x8 LED Matrix in a project I am building. I want to be able to pass an integer value between 1 and 100 to the matrix's and for them to display this number.
Would your library, using the command below, be able to provide this functionality do you know?

HCMAX7219.printMatrix(Value, Decimal_Position, Offset)

To add further detail, I am wanting a single digits i.e. 1-9 to appear on the one matrix and then number 10 or more to appear across the two.

Your comments are very much appreciated.

David

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: HCMAX7219 - LED driver library

Post by andrew » Wed Mar 14, 2018 10:00 am

Yes, if I understand you correctly that will work. Just set the 'offset' column parameter so that your number appears across both displays. If you don't need a decimal point then just use this version:

Code: Select all

HCMAX7219.printMatrix(Value, Offset)
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

DavidP
Posts: 3
Joined: Tue Mar 13, 2018 5:30 pm

Re: HCMAX7219 - LED driver library

Post by DavidP » Thu Mar 15, 2018 5:43 pm

Hi Andrew,

Thank you for your reply I managed to get this to work. do you know where I can amend the pin allocations. I have looked in the .h file and cannot find them. I know we specify the load pin within the program but, I would like to amend the other two pins.

I also have one further question. I would like to use a 4 digit 7 segment display alongside the two 8x8 led matrix, would I be able to control this using your library or could I use an additional library such as https://github.com/avishorp/TM1637 .

Apologies if this is asking beyond that which you would normally help with.

David

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: HCMAX7219 - LED driver library

Post by andrew » Fri Mar 16, 2018 11:13 am

do you know where I can amend the pin allocations
It uses the hardware SPI interface to output the data to the ICs so I'm afraid the clock and data pins can't be changed.
I also have one further question. I would like to use a 4 digit 7 segment display alongside the two 8x8 led matrix, would I be able to control this using your library....
I haven't tested the library in this way but I can't think of any reason why it wouldn't work. Just use the appropriate HCMAX7219.print7Seg() or HCMAX7219.printMatrix() function depending on the type of display your outputting to.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

DavidP
Posts: 3
Joined: Tue Mar 13, 2018 5:30 pm

Re: HCMAX7219 - LED driver library

Post by DavidP » Wed Mar 21, 2018 7:48 pm

Hi Andrew,

I have one final question, I have managed to make my program work, however I want to know if it is possible to change the output of a specific number from the library to the 8x8 matrix. Specifically the number 100, as to make it fit across my 2,8x8 matrix. I hope that makes sense.

David

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: HCMAX7219 - LED driver library

Post by andrew » Thu Mar 22, 2018 9:42 am

I'm not sure if you talking about making the font smaller or making the font proportional so it takes up less columns. In both cases this would require significant modification to the library. For the former you would need to generate a smaller font and modify the library to handle this smaller sized font. Also note that fonts smaller than 8x8 tend to look ugly.

If you mean the latter then you again need to modify the library to handle different width characters and even then without reducing the size of the font a value of 100 still wouldn't fit across two displays.

The only easy options I can think of is to simply scroll the number across the display or, if it's just for the value 100, you could use the HCMAX7219.DisplayBuffer[] function to write your own bitmap for this value directly to the display buffer.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

PeterB
Posts: 4
Joined: Wed Dec 05, 2018 8:40 am

Re: HCMAX7219 - LED driver library

Post by PeterB » Wed Dec 05, 2018 9:24 am

Hello

I would like to use your 8 digit 7 segment display with an Arduino based milling machine digital readout which is presently working fine with a LCD display. I have got the library installed and I can read an increasing variable on the 7 segment display. However the display reads from left to right and I need it to increment from right to left, ie 00.001 etc and also display a - sign for a decrementing negative number as the machine table moves?

Is this possible? I've looked through the forums for an answer without success, sorry if I've missed it somewhere, one of the problems with being a novice!

Thanks Peter

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: HCMAX7219 - LED driver library

Post by andrew » Thu Dec 06, 2018 10:59 am

I'm not totally sure what it is you need to do but as I have been asked similar questions before I've updated the library (V0.5) with a new print7Seg() member function that give a bit more control over how a number is displayed. Maybe it may allow you to do what you need. Here's an example which you can play around with the numbers to see how it works:

  1. #include <HCMAX7219.h>
  2. #include "SPI.h"
  3.  
  4. #define LOAD 10
  5.  
  6. HCMAX7219 HCMAX7219(LOAD);
  7.  
  8.  
  9. void setup()
  10. {  
  11.   HCMAX7219.Init();
  12.   HCMAX7219.Clear();
  13. }
  14.  
  15.  
  16. void loop()
  17. {
  18.   float Number = -12.3456;
  19.   byte DecimalPlaces = 3;
  20.   byte NumberOfDigits = 8;
  21.   byte Offset = 8;
  22.  
  23.   HCMAX7219.print7Seg(Number, DecimalPlaces, NumberOfDigits, Offset);
  24.  
  25.   HCMAX7219.Refresh();  
  26.  
  27.   while(1);
  28. }
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

PeterB
Posts: 4
Joined: Wed Dec 05, 2018 8:40 am

Re: HCMAX7219 - LED driver library

Post by PeterB » Thu Dec 06, 2018 2:28 pm

Thanks Andrew, I'll give it a try.

A bit stuck at the moment as I cannot install the 0.5 version into the library as I get the error message "A library named HCMAX7219 already exists" and there doesnt appear to be a way to over write it or delete the original?

Goggling for a solution but this seems to be a problem with Arduino and the IDE?

andrew
Site Admin
Posts: 1374
Joined: Sun Aug 05, 2012 4:15 pm

Re: HCMAX7219 - LED driver library

Post by andrew » Thu Dec 06, 2018 3:36 pm

You can either just delete the existing library folder (HCMAX7219) which assuming your using windows should be in My Documents\Arduino\libraries\, restart the Arduino IDE and then install the new library.

Or just overwrite the HCMAX7219.cpp and MAX7219.h files in the above installed library folder with the ones found in the V0.5 zip file you've just downloaded.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “Arduino”