Hello guys,
i have a problem with the tft library. I cant display the Omega (Ohm) sign on my LCD screen from Arduino.
I am using tftscreen.text(). I would be very grateful about help.
Hello guys,
i have a problem with the tft library. I cant display the Omega (Ohm) sign on my LCD screen from Arduino.
I am using tftscreen.text(). I would be very grateful about help.
Hey man, I know this is like a month old now, but I came across this thread while trying to solve my own problem and figured I'd come back and post the solution I found in case you still need or it pops up for anyone else during their searches...
Anyway, I don't know all the technical lingo, but basically if you're using the regular TFT library supplied with the arduino software the ohm symbol is character 233 in the default fonts character array or whatever. I have no clue how you'd do it the way the "display text" example does
I.e.
tft.stroke (0, 0, 0);
tft.setTextSize(1);
tft.text("Hello world");
But it seems to work just fine by doing it like this:
//tft is whatever you named your tft instance in
//TFT tft = TFT(cs, dc, rst);
tft.drawChar(0, 0, 233, TFT_BLACK, 0, 1);
That's it. Nothing else to it. Here's an explanation of the arguments as I understand them:
tft.drawChar(x pos, y pos, character number, character color, BG color, text size); so basically the code above prints the ohm symbol at the left corner, in black, with no background, in the regular 5x7 or whatever.
A few things to note, for some reason it looks like one pixel in the lower right corner is missing, but at size 1 it works... And I have no idea where the bitmaps for the font are stored to modify it. Also, where it says TFT_BLACK, i have no idea what you'd write as I modified the Adafruit_ST7735.h file found in Arduino/libraries/TFT/src/utility to this:
// Color definitions
#define TFT_BLACK 0x0000
#define TFT_BLUE 0x001F
#define TFT_RED 0xF800
#define TFT_GREEN 0x07E0
#define TFT_CYAN 0x07FF
#define TFT_MAGENTA 0xF81F
#define TFT_YELLOW 0xFFE0
#define TFT_WHITE 0xFFFF
Because whatever was there took way longer to write