HCDotMatrix Arduino library for 8x8 LED dot matrix module

Useful guides, libraries, and example sketches to support our Arduino based products.
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:19 pm

my Arduino IDE installations are basic from www.arduino.cc
May be it is missing a library to correctly decode yours ?

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 » Thu Nov 22, 2018 10:01 am

The issue seems to be with the way it is storing the font. The font is basically an array of bitmap data which should be stored as type 'char' which when compiled for an Uno is actually stored as a type 'byte'. However for some reason when your IDE is compiling it is storing it as type 'int' and then complaining its having to convert it back to type 'byte'.

The fix should be quite simple but as I can't replicate the error I can't confirm the fix. Could you possibly give the following a try:

In a text editor (don't use Windows notepad it will mess up the formatting, use something like notepad++ to edit it - https://notepad-plus-plus.org/) open up the file header file HCDotMatrix.h.

Find line 87 and change:

  1. const char Font8x8[][8] PROGMEM =


to
  1. const byte Font8x8[][8] PROGMEM =

Save it and try to compile it again.
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 » Thu Nov 22, 2018 11:10 pm

It compiles with very less warnings, but LEDs are still always on.

Here are the compile message :

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

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

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

^

C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.cpp:213:74: warning: default argument given for parameter 2 of 'void HCDotMatrix::print(float, unsigned int, byte)' [-fpermissive]

void HCDotMatrix::print(float Value, unsigned int Offset = 8, byte DP = 2)

^

In file included from C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.cpp:47:0:

C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.h:194:8: note: previous specification in 'void HCDotMatrix::print(float, unsigned int, byte)' here

void print(float Value, unsigned int Offset = 8, byte DP = 2);

^

C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.cpp:213:74: warning: default argument given for parameter 3 of 'void HCDotMatrix::print(float, unsigned int, byte)' [-fpermissive]

void HCDotMatrix::print(float Value, unsigned int Offset = 8, byte DP = 2)

^

In file included from C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.cpp:47:0:

C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.h:194:8: note: previous specification in 'void HCDotMatrix::print(float, unsigned int, byte)' here

void print(float Value, unsigned int Offset = 8, byte DP = 2);

^

C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.cpp:232:60: warning: default argument given for parameter 2 of 'void HCDotMatrix::printChar(char, byte)' [-fpermissive]

void HCDotMatrix::printChar(char Character, byte Offset = 8)

^

In file included from C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.cpp:47:0:

C:\Users\decraene\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.h:195:8: note: previous specification in 'void HCDotMatrix::printChar(char, byte)' here

void printChar(char Character, byte Offset = 8);

^


Le croquis utilise 4 928 octets (15%) de l'espace de stockage de programmes. Le maximum est de 32 256 octets.
Les variables globales utilisent 92 octets (4%) de mémoire dynamique, ce qui laisse 1 956 octets pour les variables locales. Le maximum est de 2 048 octets.

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 » Fri Nov 23, 2018 10:21 am

I've downloaded the latest version of the IDE (V1.8.7) just in case Arduino have updated something that is breaking the library but I still cannot replicate your issue. It is weird, it's like your IDE is compiling for a different board type, or is using a different tool chain to compile the sketch.

If it's not inconvenient to do so could you try uninstalling the IDE and reinstalling a new copy? Failing this you could try downloading the latest zip version. This will just run from its unzipped folder and will no affect your installed copy:

https://www.arduino.cc/download_handler ... indows.zip
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 » Fri Nov 23, 2018 11:09 am

I use a third windows 7 PC (my daughter one) free of any software except avast and office to install Arduino IDE 1.8.7 from your link.
I still have the same issue :(
Nevertheless I'm starting a elearning course on C++ programming, I hope I will understand how to decode these fantastic libraries that replace a digitalWrite....

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 » Fri Nov 23, 2018 4:43 pm

Ok thanks for checking. Just in case you want to investigate the issue further:

In your Arduino IDE go to File->Preferences and in the window that opens up find the bit that says 'Show verbose output during:' and then click the checkbox next to it labelled 'compilation'.

Click on the OK button to close the window and try compiling the sketch again. This time the IDE should output a lot more information when it tries to compile the sketch. Could you cut and paste this information and I'll see if I can spot anything odd going on there.
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 » Fri Nov 23, 2018 8:26 pm

here it is :

C:\arduino-1.8.7\arduino-builder -dump-prefs -logger=machine -hardware C:\arduino-1.8.7\hardware -tools C:\arduino-1.8.7\tools-builder -tools C:\arduino-1.8.7\hardware\tools\avr -built-in-libraries C:\arduino-1.8.7\libraries -libraries C:\Users\kirikette\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10807 -build-path C:\Users\KIRIKE~1\AppData\Local\Temp\arduino_build_272464 -warnings=all -build-cache C:\Users\KIRIKE~1\AppData\Local\Temp\arduino_cache_429260 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\arduino-1.8.7\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\arduino-1.8.7\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\arduino-1.8.7\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\arduino-1.8.7\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\arduino-1.8.7\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\arduino-1.8.7\hardware\tools\avr -verbose C:\Users\kirikette\Documents\Arduino\libraries\HCDotMatrix\examples\HCDotMatrix_Example-v2\HCDotMatrix_Example-v2.ino
C:\arduino-1.8.7\arduino-builder -compile -logger=machine -hardware C:\arduino-1.8.7\hardware -tools C:\arduino-1.8.7\tools-builder -tools C:\arduino-1.8.7\hardware\tools\avr -built-in-libraries C:\arduino-1.8.7\libraries -libraries C:\Users\kirikette\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10807 -build-path C:\Users\KIRIKE~1\AppData\Local\Temp\arduino_build_272464 -warnings=all -build-cache C:\Users\KIRIKE~1\AppData\Local\Temp\arduino_cache_429260 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\arduino-1.8.7\hardware\tools\avr -prefs=runtime.tools.avrdude-6.3.0-arduino14.path=C:\arduino-1.8.7\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\arduino-1.8.7\hardware\tools\avr -prefs=runtime.tools.avr-gcc-5.4.0-atmel3.6.1-arduino2.path=C:\arduino-1.8.7\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\arduino-1.8.7\hardware\tools\avr -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\arduino-1.8.7\hardware\tools\avr -verbose C:\Users\kirikette\Documents\Arduino\libraries\HCDotMatrix\examples\HCDotMatrix_Example-v2\HCDotMatrix_Example-v2.ino
Using board 'uno' from platform in folder: C:\arduino-1.8.7\hardware\arduino\avr
Using core 'arduino' from platform in folder: C:\arduino-1.8.7\hardware\arduino\avr
Detecting libraries used...
"C:\\arduino-1.8.7\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\arduino-1.8.7\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\arduino-1.8.7\\hardware\\arduino\\avr\\variants\\standard" "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464\\sketch\\HCDotMatrix_Example-v2.ino.cpp" -o nul
"C:\\arduino-1.8.7\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\arduino-1.8.7\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\arduino-1.8.7\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Users\\kirikette\\Documents\\Arduino\\libraries\\HCDotMatrix" "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464\\sketch\\HCDotMatrix_Example-v2.ino.cpp" -o nul
Using cached library dependencies for file: C:\Users\kirikette\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.cpp
Generating function prototypes...
"C:\\arduino-1.8.7\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\arduino-1.8.7\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\arduino-1.8.7\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Users\\kirikette\\Documents\\Arduino\\libraries\\HCDotMatrix" "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464\\sketch\\HCDotMatrix_Example-v2.ino.cpp" -o "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464\\preproc\\ctags_target_for_gcc_minus_e.cpp"
"C:\\arduino-1.8.7\\tools-builder\\ctags\\5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464\\preproc\\ctags_target_for_gcc_minus_e.cpp"
Compilation du croquis...
"C:\\arduino-1.8.7\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR "-IC:\\arduino-1.8.7\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\arduino-1.8.7\\hardware\\arduino\\avr\\variants\\standard" "-IC:\\Users\\kirikette\\Documents\\Arduino\\libraries\\HCDotMatrix" "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464\\sketch\\HCDotMatrix_Example-v2.ino.cpp" -o "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464\\sketch\\HCDotMatrix_Example-v2.ino.cpp.o"
C:\Users\kirikette\Documents\Arduino\libraries\HCDotMatrix\examples\HCDotMatrix_Example-v2\HCDotMatrix_Example-v2.ino: In function 'void loop()':

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

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

^

Compiling libraries...
Compiling library "HCDotMatrix"
Utilisation du fichier déjà compilé : C:\Users\KIRIKE~1\AppData\Local\Temp\arduino_build_272464\libraries\HCDotMatrix\HCDotMatrix.cpp.o
Compiling core...
Using precompiled core: C:\Users\KIRIKE~1\AppData\Local\Temp\arduino_cache_429260\core\core_arduino_avr_uno_68495cf6d2e97e9a7605a52e6c66f9d4.a
Linking everything together...
"C:\\arduino-1.8.7\\hardware\\tools\\avr/bin/avr-gcc" -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega328p -o "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464/HCDotMatrix_Example-v2.ino.elf" "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464\\sketch\\HCDotMatrix_Example-v2.ino.cpp.o" "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464\\libraries\\HCDotMatrix\\HCDotMatrix.cpp.o" "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464/..\\arduino_cache_429260\\core\\core_arduino_avr_uno_68495cf6d2e97e9a7605a52e6c66f9d4.a" "-LC:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464" -lm
C:\Users\kirikette\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.cpp: In function 'print.constprop':

C:\Users\kirikette\Documents\Arduino\libraries\HCDotMatrix\HCDotMatrix.cpp:234:37: warning: 'ColIndex' may be used uninitialized in this function [-Wmaybe-uninitialized]

byte StartIndex = 0, EndIndex = 7, ColIndex;

^

"C:\\arduino-1.8.7\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464/HCDotMatrix_Example-v2.ino.elf" "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464/HCDotMatrix_Example-v2.ino.eep"
"C:\\arduino-1.8.7\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -R .eeprom "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464/HCDotMatrix_Example-v2.ino.elf" "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464/HCDotMatrix_Example-v2.ino.hex"
Utilisation de la bibliothèque HCDotMatrix prise dans le dossier : C:\Users\kirikette\Documents\Arduino\libraries\HCDotMatrix (legacy)
"C:\\arduino-1.8.7\\hardware\\tools\\avr/bin/avr-size" -A "C:\\Users\\KIRIKE~1\\AppData\\Local\\Temp\\arduino_build_272464/HCDotMatrix_Example-v2.ino.elf"
Le croquis utilise 4940 octets (15%) de l'espace de stockage de programmes. Le maximum est de 32256 octets.
Les variables globales utilisent 92 octets (4%) de mémoire dynamique, ce qui laisse 1956 octets pour les variables locales. Le maximum est de 2048 octets.

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 » Mon Nov 26, 2018 10:01 am

Thanks again for that. I've looked though it but can't see anything wrong. Paths are correct and it's compiling for the correct processor. However I still can't replicate the issue even after installing the latest version of the IDE. I going to set up a clean system and install the IDE on that so I can be sure it's not being caused by something in a new version of the IDE.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

yannigr
Posts: 3
Joined: Sun Mar 31, 2019 4:19 pm

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

Post by yannigr » Sun Mar 31, 2019 5:30 pm

I am also having issues with this sketch, here are the errors I get after compiling :

Code: Select all

C:\Users\yanni\AppData\Local\Temp\arduino_modified_sketch_742345\HCDotMatrix_Example.ino: In function 'void loop()':

C:\Users\yanni\AppData\Local\Temp\arduino_modified_sketch_742345\HCDotMatrix_Example.ino:89:52: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

     HCDotMatrix.print("HobbyComponents.com", Column);
I had more errors before but I made the changes proposed by Andrew below and it reduced the number of warnings. Nevertheless it isn't good enough and it compiles but I get random pixels lighting up.
andrew wrote:
Thu Nov 22, 2018 10:01 am
The issue seems to be with the way it is storing the font. The font is basically an array of bitmap data which should be stored as type 'char' which when compiled for an Uno is actually stored as a type 'byte'. However for some reason when your IDE is compiling it is storing it as type 'int' and then complaining its having to convert it back to type 'byte'.

The fix should be quite simple but as I can't replicate the error I can't confirm the fix. Could you possibly give the following a try:

In a text editor (don't use Windows notepad it will mess up the formatting, use something like notepad++ to edit it - https://notepad-plus-plus.org/) open up the file header file HCDotMatrix.h.

Find line 87 and change:

  1. const char Font8x8[][8] PROGMEM =


to
  1. const byte Font8x8[][8] PROGMEM =

Save it and try to compile it again.

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 » Mon Apr 01, 2019 8:13 am

Can you let me know what version of the Arduino IDE, and type of Arduino board you are using and I'll see if I can replicate it.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “Arduino”