Hi all, hoping someone can shine a bit of light on this issue.
In the past I have used several Seeed studio 2.8 inch tft's with TFTv2.h however these seem to be hard to come by now so I've ended up with a waveshere 2.8 display for my latest project.
I believe HX8347D is the driver code that I require and indeed it draws lines and shapes easily enough but I'm struggling with text and numbers.
to display a line of text in TFTv2 (Seeed studio) I simply type;
Where 55 and 145 are coordinates
2 is the text size and obviously white being the colour, all straight forward,
However the HX8347D requires this;
Tft.lcd_display_string(60, 120, (const uint8_t *)"Hello, world !", FONT_1608, RED);
This looks very intimidating, obviously “60 and 120” are the coordinates but what is “ (const uint8_t *)”, this would appear to be some sort of pointer, and finally “FONT_1608, RED”, this presumably would be the font but how do I change the size of the font? or a different font?
I also need to display numbers however I'm struggling to find any examples.
First off. Please post a link to the actual Shield that you have bought.
Waveshare 2.8 used to have HX8347D controller.
Waveshare 2.8 now contains ILI9341 ST7789
I suggest that you use Adafruit_ST7789 library for the new Shield. Install via IDE Library Manager.
Or perhaps https://github.com/prenticedavid/HX8347D_kbv for the older Shield. This is not a "public" library. You need to install via ZIP (or Git)
I know that you are accustomed to the Seeed syntax. The graphics functions are "similar" to the Adafruit_GFX class that is used by 90% of all Arduino libraries.
I suggest that you move over to GFX libraries. e.g. use Adafruit_ST7789 for your existing Seeed Shield(s).
Sadly there isn't too much info as to regards what version it is.
I will try the GFX libraries, I've steered away from them in the past as they look a rather daunting compared to the Seeed studio code.
Regarding GFX and Seeed. drawLine(), drawCircle(), ... are exactly the same.
drawRect() and drawRectangle() are just different spelling.
GFX uses setCursor() and print()
Seeed uses setXY() and drawString(), drawNumber(), ...
It all depends on how much is tied up in Seeed code.
Future projects for almost every hardware will use GFX style libraries.
From memory, HX8347D Shield only works on Uno, Leo, Mega2560, Due. (and STM32 Nucleo) Nano-Every.
If you want different targets, say which. (or post links)
Is there a prefix to setCurser() such as Tft.setCurser() or Lcd.setCurser() ?
I'm getting 'setCurser was not declared in this scope'.
I've looked through the Adafruit tutorial a dozen times but I must be missing something, they are usually really easy to follow.
Sorry for the dumb questions but I'm not going to let this beat me.
Once you have the HX8347D_kbv examples running ok, try some othe GFX programs.
As a general rule you only need to alter the include and constructor statements to
#include <HX8347D_kbv.h>
HX8347D_kbv tft;
and statements like tft.setCursor(x, y)
Note the spelling.
Obviously if you like to spell your object Tft or Lcd you use that instead of tft
If you have a particular custom project to "port", just attach the file.
I might even "translate" it to GFX for you.
There is little point until you have confirmed that you have HX8347D version (and it is working 100%)
I've included HX8347D.h, I will change that for HX8347D_kbv.h
I'm away from the project at the moment but will give that a try tomorrow, many thanks for your help.
Edit.
OK I loaded the graphicstest_kbv sketch this morning and its working a treat, I should be able to find everything I need from this, the quality of the graphics is quite impressive.
I'm hoping many others will find this thread useful in the future.
OK the display is working a treat but I'm struggling to find any touch examples, I guess I should be using Touch.h and XPT2046.h.?
I've run the example 'Touch panel' which works fine so I'm happy with the hardware however I cant find the commands to get the x and y coordinates and the z pressure. I'm sure in the past I have used 'TouchSreen.h' however that seems not to be compatible.