Skip to content

Getting rid of trailing digit #1814

Discussion options

You must be logged in to vote

There are a few thing that are not quite right:

  1. The print stream does not support paddiing or datum setting (this is becuase the library is fed chanracters one by one, so the library does not know where to put the first character in that case)
  2. The text size must be set before the textWidth function is called so the pixel width can be calculated
  3. The background colour must be specified

Here is a working sketch:

#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI();

void setup() {
  tft.begin();
  tft.setRotation(0);
  tft.fillScreen(TFT_BLACK);
  tft.setTextColor(TFT_GREEN, TFT_BLUE);
}

void loop() {

  uint16_t x = tft.width()/2;
  uint16_t y = tft.height()/2;

  // Set datum to Middle Centr…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mike-rankin
Comment options

Answer selected by Bodmer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants