HCDotMatrix Arduino library for 8x8 LED dot matrix module

Useful guides, libraries, and example sketches to support our Arduino based products.
theenggprojects
Posts: 1
Joined: Thu Dec 03, 2015 7:27 pm

Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul

Post by theenggprojects » Thu Dec 03, 2015 7:28 pm

[POST DELETED BY ADMIN] Please see section 5.2 of forum terms and conditions.

paulnaude
Posts: 1
Joined: Wed Sep 13, 2017 6:34 am

Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul

Post by paulnaude » Sun Sep 17, 2017 11:25 am

:D This is really awesome for people with only one 8x8 led block and no controller block to plug it in like myself who only now started opening the Arduino world! Thanks so much.
My block configuration was also different but I got it to work by changing row and column numbers etc. It's a pity the manufactures do not print the row and column numbers and don't even put them in sequence...
:?: One question though: I saw in the code that only printable ASCII characters are printable. What would be required to print others, like é (alt+130) or ± (alt+0177) etc.?

Regards

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

Re: HCDotMatrix Arduino library for 8x8 LED dot matrix modul

Post by andrew » Mon Sep 18, 2017 9:51 am

Thanks. The character set was deliberately limited as it eats up a lot of memory on low power Arduinos such as Unos, Nanos, etc. To get around your problem there are two options that come to mind:

You could extend the character set by editing the font array (Font8x8[][8]) in the HCDotMatrix.h header file (use a proper text editor to do this like Notepad++, don't use the built in Windows Notepad). The font starts on line 87 and ends on line 182. Each row of numbers is an 8x8 bitmap for each ASCII character. To extend the font you can just simply add some more rows to the end of the array. Currently the last row is the bitmap for the ASCII character '~' (ASCII code 126). If you reference the following page you will see table for the standard and extended ASCII characters:

http://www.asciitable.com/

You'll see from the extended table that 'é' is only an additional 4 character after the '~' so you'd just add 4 rows on to the end of the array with each row containing the bitmap information for each additional character after the '~' up to the 'é'.

If you do this there is one additional edit you'll need to do in the HCDotMatrix.cpp file. In this file there is a check to make sure the character being printed in within the range of the font. Just go to line 240 and change this:

Code: Select all

/* ASCII character must be printable ! */
		if(Character < ' ' || Character > '~')

To something like this:

Code: Select all

/* ASCII character must be printable ! */
		if(Character < ' ' || Character > 'é')
Note the last character checked has now been changed from '~' to 'é'



Alternatively if you don't wish to edit the library you can just draw any character yourself using the libraries setLED() function:
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

philippedc
Posts: 9
Joined: Mon Nov 19, 2018 11:33 pm

Re: HCDotMatrix Arduino library for 8x8 LED dot matrix module

Post by philippedc » Tue Nov 20, 2018 7:02 pm

Hi, what a fantastic way to be able to drive leds matrix easily without any max ic, but I have a problem, I would appreciate any help :

In file included from C:\Users\isanaba-31\Documents\Arduino\libraries\HCDotMatrix\examples\HCDotMatrix_Example\HCDotMatrix_Example.ino:52:0:

C:\Users\isanaba-31\Documents\Arduino\libraries\HCDotMatrix/HCDotMatrix.h:183:1: error: narrowing conversion of '242' from 'int' to 'char' inside { } [-Wnarrowing]

};

^

C:\Users\isanaba-31\Documents\Arduino\libraries\HCDotMatrix/HCDotMatrix.h:183:1: error: narrowing conversion of '242' from 'int' to 'char' inside { } [-Wnarrowing]

C:\Users\isanaba-31\Documents\Arduino\libraries\HCDotMatrix/HCDotMatrix.h:183:1: error: narrowing conversion of '224' from 'int' to 'char' inside { } [-Wnarrowing]

C:\Users\isanaba-31\Documents\Arduino\libraries\HCDotMatrix/HCDotMatrix.h:183:1: error: narrowing conversion of '224' from 'int' to 'char' inside { } [-Wnarrowing]

etc.......................

C:\Users\isanaba-31\Documents\Arduino\libraries\HCDotMatrix\examples\HCDotMatrix_Example\HCDotMatrix_Example.ino: In function 'void loop()':

C:\Users\isanaba-31\Documents\Arduino\libraries\HCDotMatrix\examples\HCDotMatrix_Example\HCDotMatrix_Example.ino:89:52: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

HCDotMatrix.print("HobbyComponents.com", Column);

^

exit status 1

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

Re: HCDotMatrix Arduino library for 8x8 LED dot matrix module

Post by andrew » Wed Nov 21, 2018 9:30 am

I'm not able to replicate the issue using the example sketch. Can you give me the following information:

1) What version of Arduino IDE are you using?

2) What Arduino board are you compiling it for?

3) What operating system are you using?
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

philippedc
Posts: 9
Joined: Mon Nov 19, 2018 11:33 pm

Re: HCDotMatrix Arduino library for 8x8 LED dot matrix module

Post by philippedc » Wed Nov 21, 2018 10:09 am

Hi Andrew, thank you for your help.
It is the 1.8.6 IDE version,
Arduino Uno,
Windows 7,

On the above message, I have only made a "verify" not a compilation with download to the board.
I will mostly use the setled function to build for instance an analog clock and a binary calendar.

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

Re: HCDotMatrix Arduino library for 8x8 LED dot matrix module

Post by andrew » Wed Nov 21, 2018 11:56 am

Still having trouble replicating the error - sorry to check again but are you absolutely sure you have 'Arduino/Genuino Uno' selected as the board type under Tools->Board ?
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

philippedc
Posts: 9
Joined: Mon Nov 19, 2018 11:33 pm

Re: HCDotMatrix Arduino library for 8x8 LED dot matrix module

Post by philippedc » Wed Nov 21, 2018 12:40 pm

OK Andrew, surely you must be right, I will verify tonight as it was done on a home PC.

So I've just installed 1.6.13 Arduino IDE on my business PC - for an unknown reason 1.8.6 couldn't start - and it works.

Many thanks !

philippedc
Posts: 9
Joined: Mon Nov 19, 2018 11:33 pm

Re: HCDotMatrix Arduino library for 8x8 LED dot matrix module

Post by philippedc » Wed Nov 21, 2018 7:35 pm

Latest news :
I'm absolutely sure I have 'Arduino/Genuino Uno' selected as the board type
I confirm the program compiles right with Arduino IDE 1.6.13 on my windows 7 business PC, but failed with 1.8.6 on my windows 7 home PC.
Best regards

philippedc
Posts: 9
Joined: Mon Nov 19, 2018 11:33 pm

Re: HCDotMatrix Arduino library for 8x8 LED dot matrix module

Post by philippedc » Wed Nov 21, 2018 10:07 pm

in fact it compiles but if the example program is running all leds are stuck bright. I know it's running because I put some Serial.println() to see.

Nevertheless if it compiles in 1.6.13, I have the same kind of errors than in 1.8.6 which failed the compilation. Here are the 6 last lines of warnings :

C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix/HCDotMatrix.h:183:1: warning: narrowing conversion of '255' from 'int' to 'const char' inside { } [-Wnarrowing]

C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix/HCDotMatrix.h:183:1: warning: narrowing conversion of '130' from 'int' to 'const char' inside { } [-Wnarrowing]

C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix/HCDotMatrix.h:183:1: warning: narrowing conversion of '238' from 'int' to 'const char' inside { } [-Wnarrowing]

C:\Users\decraene\Google Drive\projets Arduino\7- heure & calendrier\HCDotMatrix_Example-v3\HCDotMatrix_Example-v3.ino: In function 'void loop()':

C:\Users\decraene\Google Drive\projets Arduino\7- heure & calendrier\HCDotMatrix_Example-v3\HCDotMatrix_Example-v3.ino:68:52: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

HCDotMatrix.print("HobbyComponents.com", Column);

Post Reply

Return to “Arduino”