HCDisplay Arduino library for Hobby Components Displays

Useful guides, libraries, and example sketches to support our Arduino based products.
andrew
Site Admin
Posts: 1407
Joined: Sun Aug 05, 2012 4:15 pm

Re: HCDisplay Arduino library for Hobby Components Displays

Post by andrew » Mon Apr 03, 2023 8:51 am

The library for 12864B Parallel/Serial Graphic LCD Module (SKU: HCMODU0032) appears to be missing.

I get the following error when compiling...

.... libraries\HCDisplay/HCDisplay.h:63:3: error: #error "No display defined!"
63 | #error "No display defined!"
| ^~~~~

You need to tell the library which display you are using by uncommenting it in the options.h file.

To do this, locate the HCDisplay library folder. If you are using Windows this should be located in My Documents\Arduino\libraries\ folder.

Inside the HCDisplay folder you should find the Options.h file. Open this in a text editor. Note that if you're using Windows, don't use the built-in windows notepad as it gets the formatting wrong. Instead use something like notepad++.

In the Options.h file make sure that all the display options are commented out (with a //) except the one for your display. For your display the file should then look like this:


  1. #define ST7920                              //12864 128x64 Pixel Graphic Display module ST7920 Controller (HCMODU0032)
  2. //#define ILI9325_SHIELD                        //2.4 Inch TFT shield (SKU: HCARDU0108)
  3. //#define ILI9327_SHIELD                            //3.2 Inch TFT shield (SKU: HCARDU0111)
  4. //#define HX8352B_SHIELD                        //3.2 Inch TFT shield (SKU: HCARDU0109)
  5. //#define ILI9341_SPI_WITH_TSC2046_TOUCH_SENSOR //2.4 & 3.2 inch TFT LCD Module with Touch Panel ILI9341 (HCMODU0133 & HCMODU0132)
  6. //#define MAX7219_DOT_MATRIX                    //8x8 Serial Dot Matrix Modules (HCOPTO0014 & HCMODU0135)
  7. //#define HCMODU0136_HT1621                     //HT1621 6 Digit 7 Segment LCD Module - Green Backlight (SKU: HCMODU0136)
  8.  
  9.  
  10. #include "Fonts/MedProp_12pt.h"
  11. #include "Fonts/LargeProp_26pt.h"
  12. #include "Fonts/LCDLarge_24pt.h"
  13. #include "Fonts/LCDLarge_52pt.h"
  14. #include "Fonts/NarrowProp24pt.h"

Whilst you're editing the file you can also comment out any fonts you're not using to save some program memory.

Once you have edited the file save it and then try compiling your sketch again.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

gbbickerton
Posts: 1
Joined: Tue Sep 26, 2017 9:26 am

Re: HCDisplay Arduino library for Hobby Components Displays

Post by gbbickerton » Tue Jul 23, 2024 6:52 pm

How do I add my own font to the library?
I have created a font using DOTFactory rle and edited it to match an existing fonts internal naming and structure, it is in the fonts directory and I have added it to the HCDisplay.h fonts list.
In a program that compiles with a built in font, when I change the font to my font I get this error message
LCD_64ptFont' was not declared in this scope.
What am I missing?

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

Re: HCDisplay Arduino library for Hobby Components Displays

Post by andrew » Wed Jul 24, 2024 8:39 am

I have created a font using DOTFactory rle and edited it to match an existing fonts internal naming and structure, it is in the fonts directory and I have added it to the HCDisplay.h fonts list.
In a program that compiles with a built in font, when I change the font to my font I get this error message
LCD_64ptFont' was not declared in this scope.
What am I missing?

It looks like you have followed the correct steps but just to sanity check, here is what you need to do to add your font file to the library:


1) Make sure that the format of your .h font file matches the format of one of the font files found in the libraries Font folder

2) Save your file in the libraries Font folder with the rest of the fonts

3) In the HCDisplay.h header file, at the top of the file there is a list of includes for each font. At the bottom of this include list and an include with the path to your font.


It's most likely something isn't correct in your font file. In particular, check whatever you are calling your font in your sketch matches what you have called it in the font information structure found at the bottom of your font file.

For example ‘Tiny_6ptFont’ is defined as ‘const FONT_INFO Tiny_6ptFont[]’ in its font .h file:

  1. const FONT_INFO Tiny_6ptFont[] =
  2. {
  3.     1, //  Character height
  4.     ' ', //  Start character
  5.     '~', //  End character
  6.     1// Spacing between characters
  7.     Tiny_6pt_Descriptors, //  Character descriptor array
  8.     Tiny_6pt_Bitmaps, //  Character bitmap array
  9. };

I could be wrong but it’s my guess those two things don’t match.

If you're still having no luck just post your file and I'll take a look at it.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Post Reply

Return to “Arduino”