Conversion from 'uint8_t' {aka 'unsigned char'} to 'String' is ambiguous

I ( a real noob ) am trying to make a touchscreen thermostat.
The analog reading from the ESP goes well, example value 205 (is multiplied by 10 for ModBus).
But i can't convert the data to a string.

void update_Room_temp()
{
  int16_t x1, y1;
  uint16_t w, h;
  String curValue = uint8_t(iRoom_temperature);
  int str_len =  curValue.length() + 1; 
  char char_array[str_len];
  curValue.toCharArray(char_array, str_len);
  tft.fillRect(31,175, 30, 21, ILI9341_RED);
  tft.setTextColor(ILI9341_WHITE, ILI9341_ULTRA_DARKGREY);
  tft.setFont(&FreeSansBold12pt7b);
  tft.getTextBounds(char_array, 40, 220, &x1, &y1, &w, &h);
  tft.setCursor(64 - w, 190);
  tft.print(char_array);
}

String curValue = uint8_t(iRoom_temperature); Here is the problem.
How can i tft.print the iRoom temperature ?

Why use a String?

char char_array[10];
snprintf(char_array, sizeof char_array, "%d", iRoom_temperature);

Which library are you using ?

Can't you simply

tft.print(iRoom_temperature);

That was my first goto as well, but it looks like the OP wants to do some positioning based on the width of the character string being printed.

Snippets always complicate things.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.