Printing one character from a char array using UTFT library

Hey Guys and Gals

I’m trying to utilise extended ASCII with the UTFT library. Arduino and UTFT only caters for the standard ASCII table. So I created a new font for the various symbols that I wanted to use with my normal text. So my strings that I want to print to my LCD are going to be a mix between two fonts.

I’m detecting touch input with uTouch and I am returning a character with a trigger variable to a function i.e. the character and a 0 for non standard characters or a 1 for special characters into separate arrays.

I want to run the two arrays in parallel with one another. Example:

Actual Char array: Meas with unit Z and display currency in E
Special Char array: 000000000000000100000000000000000000000001

Text to be displayed: Meas with unit Ω and display currency in €

So I want to print one character at a time. Before printing I will reference the Special Char array, if the value is 0 then the font will be the normal font and the program will print the character. The process then repeats and if the special Char array cell value is 1 then the font will be changed to the special character font, print the character and return the font to the normal font.

The result should then yield the same as the “Text to be displayed” example which I used above. If I print my string with the UTFT print function then it works fine:

myGLCD.print(stCurrent,Button_X_Begin + 12,Button_Y_Begin - 49);

but if I try and only print one character at a time:

myGLCD.print(stCurrent[stCurrentLen],Button_X_Begin + 12 + (16 * stCurrentLen),Button_Y_Begin - 49);

Then I get an error when I try to compile it: “invalid conversion from ‘char’ to ‘char*’ [-fpermissive]”

Could someone please advise how I can get this to work please? Thank you in advance.

The rest of the function below:

void updateStr(int val, int Trigger, int ASCII_DEC)
{
  myGLCD.setFont(Grotesk16x32);
  myGLCD.setBackColor(VGA_WHITE);
  myGLCD.setColor(Button_Text_Color);
        
      
  if (stCurrentLen<42)
  {
      stCurrent[stCurrentLen]= val;
      stCurrent[stCurrentLen+1]='\0';        

      stSpecTrig[stCurrentLen] = Trigger;
      stSpecTrig[stCurrentLen+1] = 9;     

      if(stSpecTrig[stCurrentLen] == 1 || stSpecTrig[stCurrentLen] == 0)
      {
        myGLCD.printNumI(stSpecTrig[stCurrentLen],Button_X_Begin + 100 + (16 * stCurrentLen) ,Button_Y_Begin - 105);  
        myGLCD.print(stCurrent[stCurrentLen],Button_X_Begin + 12 + (16 * stCurrentLen),Button_Y_Begin - 49);         //    Text field 42 characters long   
      }

     stCurrentLen++; 
}

Did you try the printChar() function? It may be private in your utft library so you will need to make it public in order to use it.

Hello HazardsMind

I wasn't aware of that specific function, but it works perfectly, thank you for the suggestion.