HCDisplay Arduino library for Hobby Components Displays

Useful guides, libraries, and example sketches to support our Arduino based products.
Gazz292
Posts: 5
Joined: Wed Jan 06, 2021 8:45 pm

Re: HCDisplay Arduino library for Hobby Components Displays

Post by Gazz292 » Thu Jan 07, 2021 1:52 pm

Thankyou for the suggestion,

unfortunatley 0x0F is also 'T/t' so it displays a 't' instead of a c,

i tried removing all the letters except the numbers, the dot and the c, but then it refuses to compile,

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

Re: HCDisplay Arduino library for Hobby Components Displays

Post by andrew » Thu Jan 07, 2021 3:19 pm

Sorry, try changing it to:

Code: Select all

						0x0E, // c
If that's still wrong I'll check it when I have access to one tomorrow.
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Gazz292
Posts: 5
Joined: Wed Jan 06, 2021 8:45 pm

Re: HCDisplay Arduino library for Hobby Components Displays

Post by Gazz292 » Thu Jan 07, 2021 3:55 pm

Woohoo, thankyou so much, that worked,
The result :
You do not have the required permissions to view the files attached to this post.

Gazz292
Posts: 5
Joined: Wed Jan 06, 2021 8:45 pm

Re: HCDisplay Arduino library for Hobby Components Displays

Post by Gazz292 » Thu Jan 07, 2021 4:04 pm

So... to allow other people to have the same thing, i'd need to include the changed .h file with the sketch?

i know i could just tell them what to do, but i know that will confuse some people, especially as some don't believe that using word / note pad mangles the code, and notepad++ scares them :)


And finally, i'll need to figure out code to allow minus temps to display but not shift the display one digit to the right,
for now i'm simply using
HCDisplay.Pos(1);
HCDisplay.Print("-10.3c");

And when i display a positive temp i put a space where the - was. but i think that's basic arduino code i need to learn there.

This will be getting the temperature as a plain text from the serial port as part of other strings, so '21.3c' or -14.1c' will be things to expect, oh yeah, i need to allow for the single to double digit thing too here for '9.6c' inputs.

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

Re: HCDisplay Arduino library for Hobby Components Displays

Post by andrew » Fri Jan 08, 2021 9:40 am

So... to allow other people to have the same thing, i'd need to include the changed .h file with the sketch?
I'll upload a version (0.2.1) of the library with a lower case 0 to the first post shortly.

And finally, i'll need to figure out code to allow minus temps to display but not shift the display one digit to the right,
This will be getting the temperature as a plain text from the serial port as part of other strings,
If you're handling the strings as character arrays, which is the format the HCDisplay library will need them to be in anyway, you can use the sizeof() function to determine how long the text is. You can then use this value to offset the position of the text when displaying it on the screen. Here is an example of how sizeof() works:

  1. void setup() {
  2.   Serial.begin(9600);
  3.  
  4.   char text[] = "-23.1c";
  5.  
  6.   Serial.print(sizeof(text));
  7. }
  8.  
  9. void loop()
  10. {
  11. }
Comments made by this poster do not necessarily reflect the views of Hobby Components Ltd.

Gazz292
Posts: 5
Joined: Wed Jan 06, 2021 8:45 pm

Re: HCDisplay Arduino library for Hobby Components Displays

Post by Gazz292 » Fri Jan 08, 2021 6:46 pm

Thankyou very much,

The data i get from the simulator is a string of plain text, so the one for interior temperature will be plain text like '21.6c' so the dot and c will always be there, just the numbers and minus symbol if needed i altering, plus the position of the test when it goes to single digit temps.

So it's easiest if i just send that text to the HC display, very handy as that is what it expects :)

Post Reply