i have a problem with strings using the command "Tft.drawString".
I wrote the following:
void CenterText(String cttext, int ctx, int cty, int ctgroesse, int ctfarbefront, int farbeback)
{
x=ctgroesse6cttext.length();
y=ctgroesse*7;
Tft.fillRectangle(ctx-x/2,cty-y/2,x,y,farbeback);
Tft.drawString(cttext, ctx-x/2 ,cty-y/2 ,ctgroesse, ctfarbefront);
}
This should give me a centered text. The idea is to give in the text "cttext" which should be centered at the ctx and cty position on the 2.8" TFT screen.
But there is something wrong with the use of the String cttext...
The Compiler says:
C:\Program Files (x86)\Arduino\libraries\TFT_Touch_Shield_V2-master/TFTv2.h:248:10: note: no known conversion for argument 1 from 'String' to 'char*'
exit status 1
no matching function for call to 'TFT::drawString(String&, int, int, int&, int&)'
void CenterText(char cttext, int ctx, int cty, int ctgroesse, int ctfarbefront, int farbeback)
{
x=ctgroesse6strlen(cttext);
y=ctgroesse7;
Tft.fillRectangle(ctx-x/2,cty-y/2,x,y,farbeback);
Tft.drawString(cttext, ctx-x/2 ,cty-y/2 ,ctgroesse, ctfarbefront);
}