Fix a global search-and-replace error which messed up examples...
This commit is contained in:
Bodmer 2023-12-11 13:17:00 +00:00
parent f40f3b17c8
commit fa6512faf4
55 changed files with 115 additions and 115 deletions

View File

@ -44,7 +44,7 @@ void setup() {
tft.fillScreen(TFT_BLACK);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE);
tft.setcursor(0, 0);
tft.setCursor(0, 0);
}
@ -54,11 +54,11 @@ void loop() {
tft.fillScreen(TFT_BLACK);
tft.setTextSize(2);
tft.setTextColor(TFT_WHITE);
tft.setcursor(40, 5);
tft.setCursor(40, 5);
tft.println(F("Arduino"));
tft.setcursor(35, 25);
tft.setCursor(35, 25);
tft.println(F("Cellular"));
tft.setcursor(35, 45);
tft.setCursor(35, 45);
tft.println(F("Automata"));
delay(1000);

View File

@ -79,7 +79,7 @@ void loop() {
if (ss==0 || initial) {
initial = 0;
tft.setTextColor(TFT_GREEN, TFT_BLACK);
tft.setcursor (8, 52);
tft.setCursor (8, 52);
tft.print(__DATE__); // This uses the standard ADAFruit small font
tft.setTextColor(TFT_BLUE, TFT_BLACK);

View File

@ -36,7 +36,7 @@ void loop() {
// Set "cursor" at top left corner of display (0,0) and select font 2
// (cursor will move to next line automatically during printing with 'tft.println'
// or stay on the line is there is room for the text with tft.print)
tft.setcursor(0, 0, 2);
tft.setCursor(0, 0, 2);
// Set the font colour to be white with a black background, set text size multiplier to 1
tft.setTextColor(TFT_WHITE,TFT_BLACK); tft.setTextSize(1);
// We can now plot text on screen using the "print" class

View File

@ -90,10 +90,10 @@ void loop() {
// The standard ADAFruit font still works as before
tft.setTextColor(TFT_BLACK);
tft.setcursor (12, 5);
tft.setCursor (12, 5);
tft.print("Original ADAfruit font!");
// The new larger fonts do not use the .setcursor call, coords are embedded
// The new larger fonts do not use the .setCursor call, coords are embedded
tft.setTextColor(TFT_BLACK, TFT_BLACK); // Do not plot the background colour
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the background colour!)

View File

@ -198,7 +198,7 @@ void jpegInfo() {
// The Due will work fine with the HX8357_Due library.
void showTime(uint32_t msTime) {
//tft.setcursor(0, 0);
//tft.setCursor(0, 0);
//tft.setTextFont(1);
//tft.setTextSize(2);
//tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -132,7 +132,7 @@ void loop(void)
d = -d;
}
tft.setcursor(0, 0);
tft.setCursor(0, 0);
tft.setTextColor(TFT_MAGENTA);
tft.println(F("Bodmer's TFT_eSPI"));
@ -343,7 +343,7 @@ uint32_t testHaD()
uint32_t t = micros() - start;
tft.setTextColor(TFT_YELLOW);
tft.setcursor(0, 145);
tft.setCursor(0, 145);
tft.print(F(" http://hackaday.io/"));
tft.print(F(" Xark"));
@ -371,7 +371,7 @@ uint32_t testFillScreen()
uint32_t testText() {
tft.fillScreen(TFT_BLACK);
uint32_t start = micros_start();
tft.setcursor(0, 0);
tft.setCursor(0, 0);
tft.setTextColor(TFT_WHITE); tft.setTextSize(1);
tft.println(F("Hello World!"));
tft.setTextColor(tft.color565(0xff, 0x00, 0x00));

View File

@ -126,7 +126,7 @@ void testlines(uint16_t color) {
}
void testdrawtext(char *text, uint16_t color) {
tft.setcursor(0, 0);
tft.setCursor(0, 0);
tft.setTextColor(color);
tft.setTextWrap(true);
tft.print(text);
@ -215,7 +215,7 @@ void testroundrects() {
void tftPrintTest() {
tft.setTextWrap(false);
tft.fillScreen(TFT_BLACK);
tft.setcursor(0, 30);
tft.setCursor(0, 30);
tft.setTextColor(TFT_RED);
tft.setTextSize(1);
tft.println("Hello World!");
@ -229,7 +229,7 @@ void tftPrintTest() {
tft.setTextSize(4);
tft.print(1234.567);
delay(1500);
tft.setcursor(0, 0);
tft.setCursor(0, 0);
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE);
tft.setTextSize(0);

View File

@ -38,7 +38,7 @@ void setup() {
tft.fillScreen(TFT_BLACK);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE);
tft.setcursor(0, 0);
tft.setCursor(0, 0);
}
@ -48,11 +48,11 @@ void loop() {
tft.fillScreen(TFT_BLACK);
tft.setTextSize(2);
tft.setTextColor(TFT_WHITE);
tft.setcursor(40, 5);
tft.setCursor(40, 5);
tft.println(F("Arduino"));
tft.setcursor(35, 25);
tft.setCursor(35, 25);
tft.println(F("Cellular"));
tft.setcursor(35, 45);
tft.setCursor(35, 45);
tft.println(F("Automata"));
delay(1000);

View File

@ -70,7 +70,7 @@ void loop() {
// For comaptibility with Adafruit_GFX library the text background is not plotted when using the print class
// even if we specify it.
tft.setTextColor(TFT_YELLOW);
tft.setcursor(xpos, ypos); // Set cursor near top left corner of screen
tft.setCursor(xpos, ypos); // Set cursor near top left corner of screen
tft.setFreeFont(TT1); // Select the orginal small TomThumb font
tft.println(); // Move cursor down a line

View File

@ -238,7 +238,7 @@ void touch_calibrate()
} else {
// data not valid so recalibrate
tft.fillScreen(TFT_BLACK);
tft.setcursor(20, 0);
tft.setCursor(20, 0);
tft.setTextFont(2);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
@ -272,7 +272,7 @@ void touch_calibrate()
// Print something in the mini status bar
void status(const char *msg) {
tft.setTextPadding(240);
//tft.setcursor(STATUS_X, STATUS_Y);
//tft.setCursor(STATUS_X, STATUS_Y);
tft.setTextColor(TFT_WHITE, TFT_DARKGREY);
tft.setTextFont(0);
tft.setTextDatum(TC_DATUM);

View File

@ -34,7 +34,7 @@ void loop() {
// Set "cursor" at top left corner of display (0,0) and select font 2
// (cursor will move to next line automatically during printing with 'tft.println'
// or stay on the line is there is room for the text with tft.print)
tft.setcursor(0, 0, 2);
tft.setCursor(0, 0, 2);
// Set the font colour to be white with a black background, set text size multiplier to 1
tft.setTextColor(TFT_WHITE,TFT_BLACK); tft.setTextSize(1);
// We can now plot text on screen using the "print" class

View File

@ -45,13 +45,13 @@ void loop() {
// The standard AdaFruit font still works as before
tft.setTextColor(TFT_BLACK); // Background is not defined so it is transparent
tft.setcursor (60, 5);
tft.setCursor (60, 5);
tft.setTextFont(0); // Select font 0 which is the Adafruit font
tft.print("Original Adafruit font!");
//tft.drawString("Original Adafruit font!",60,5,1);
// The new larger fonts do not need to use the .setcursor call, coords are embedded
// The new larger fonts do not need to use the .setCursor call, coords are embedded
tft.setTextColor(TFT_BLACK); // Do not plot the background colour
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the background colour!)
tft.drawCentreString("Font size 2", 120, 14, 2); // Draw text centre at position 120, 14 using font 2
@ -74,15 +74,15 @@ void loop() {
tft.setTextColor(TFT_BLACK); // Set text colour to black, no background (so transparent)
tft.setcursor(36, 150, 4); // Set cursor to x = 36, y = 150 and use font 4
tft.setCursor(36, 150, 4); // Set cursor to x = 36, y = 150 and use font 4
tft.println("Transparent..."); // As we use println, the cursor moves to the next line
tft.setcursor(30, 175); // Set cursor to x = 30, y = 175
tft.setCursor(30, 175); // Set cursor to x = 30, y = 175
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set text colour to white and background to black
tft.println("White on black");
tft.setTextFont(4); // Select font 4 without moving cursor
tft.setcursor(50, 210); // Set cursor to x = 50, y = 210 without changing the font
tft.setCursor(50, 210); // Set cursor to x = 50, y = 210 without changing the font
tft.setTextColor(TFT_WHITE);
// By using #TFT print we can use all the formatting features like printing HEX
tft.print(57005, HEX); // Cursor does no move to next line

View File

@ -38,7 +38,7 @@ void setup(void) {
void loop() {
tft.fillScreen(TFT_BLUE);
tft.setcursor(0, 0, 2);
tft.setCursor(0, 0, 2);
// Set the font colour to be white with a black background
tft.setTextColor(TFT_WHITE, TFT_BLACK);
// We can now plot text on screen using the "print" class

View File

@ -117,7 +117,7 @@ void loop(void)
d = -d;
}
tft.setcursor(0, 0);
tft.setCursor(0, 0);
tft.setTextColor(TFT_MAGENTA);
tft.setTextSize(2);
@ -362,9 +362,9 @@ uint32_t testHaD()
tft.setTextColor(TFT_YELLOW);
tft.setTextSize(2);
tft.setcursor(8, 285);
tft.setCursor(8, 285);
tft.print(F("http://hackaday.io/"));
tft.setcursor(96, 302);
tft.setCursor(96, 302);
tft.print(F("Xark"));
delay(3 * 1000L);
@ -389,7 +389,7 @@ uint32_t testText()
{
tft.fillScreen(TFT_BLACK);
uint32_t start = micros_start();
tft.setcursor(0, 0);
tft.setCursor(0, 0);
tft.setTextColor(TFT_WHITE,TFT_BLACK); tft.setTextSize(1);
tft.println(F("Hello World!"));
tft.setTextSize(2);

View File

@ -121,7 +121,7 @@ unsigned long testFillScreen() {
unsigned long testText() {
tft.fillScreen(TFT_BLACK);
unsigned long start = micros();
tft.setcursor(0, 0);
tft.setCursor(0, 0);
tft.setTextColor(TFT_WHITE); tft.setTextSize(1);
tft.println("Hello World!");
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);

View File

@ -38,7 +38,7 @@ void setup() {
tft.fillScreen(TFT_BLACK);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE);
tft.setcursor(0, 0);
tft.setCursor(0, 0);
}
@ -48,11 +48,11 @@ void loop() {
tft.fillScreen(TFT_BLACK);
tft.setTextSize(2);
tft.setTextColor(TFT_WHITE);
tft.setcursor(40, 5);
tft.setCursor(40, 5);
tft.println(F("Arduino"));
tft.setcursor(35, 25);
tft.setCursor(35, 25);
tft.println(F("Cellular"));
tft.setcursor(35, 45);
tft.setCursor(35, 45);
tft.println(F("Automata"));
delay(1000);

View File

@ -56,7 +56,7 @@ void loop() {
// For comaptibility with Adafruit_GFX library the text background is not plotted when using the print class
// even if we specify it.
tft.setTextColor(TFT_YELLOW, TFT_BLACK);
tft.setcursor(xpos, ypos); // Set cursor near top left corner of screen
tft.setCursor(xpos, ypos); // Set cursor near top left corner of screen
tft.setTextFont(GLCD); // Select the orginal small GLCD font by using NULL or GLCD
tft.println(); // Move cursor down a line

View File

@ -241,7 +241,7 @@ void touch_calibrate()
} else {
// data not valid so recalibrate
tft.fillScreen(TFT_BLACK);
tft.setcursor(20, 0);
tft.setCursor(20, 0);
tft.setTextFont(2);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
@ -275,7 +275,7 @@ void touch_calibrate()
// Print something in the mini status bar
void status(const char *msg) {
tft.setTextPadding(240);
//tft.setcursor(STATUS_X, STATUS_Y);
//tft.setCursor(STATUS_X, STATUS_Y);
tft.setTextColor(TFT_WHITE, TFT_DARKGREY);
tft.setTextFont(0);
tft.setTextDatum(TC_DATUM);

View File

@ -34,7 +34,7 @@ void loop() {
// Set "cursor" at top left corner of display (0,0) and select font 2
// (cursor will move to next line automatically during printing with 'tft.println'
// or stay on the line is there is room for the text with tft.print)
tft.setcursor(0, 0, 2);
tft.setCursor(0, 0, 2);
// Set the font colour to be white with a black background, set text size multiplier to 1
tft.setTextColor(TFT_WHITE,TFT_BLACK); tft.setTextSize(1);
// We can now plot text on screen using the "print" class

View File

@ -44,11 +44,11 @@ void loop() {
// The standard AdaFruit font still works as before
tft.setTextColor(TFT_BLACK); // Background is not defined so it is transparent
tft.setcursor (100, 5);
tft.setCursor (100, 5);
tft.setTextFont(1); // Select font 1 which is the Adafruit GLCD font
tft.print("Original Adafruit font!");
// The new larger fonts do not need to use the .setcursor call, coords are embedded
// The new larger fonts do not need to use the .setCursor call, coords are embedded
tft.setTextColor(TFT_BLACK); // Do not plot the background colour
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the background colour!)
tft.drawCentreString("Font size 2", 160, 14, 2); // Draw text centre at position 120, 14 using font 2
@ -69,15 +69,15 @@ void loop() {
tft.setTextSize(1); // We are using a text size multiplier of 1
tft.setTextColor(TFT_BLACK); // Set text colour to black, no background (so transparent)
tft.setcursor(76, 150, 4); // Set cursor to x = 76, y = 150 and use font 4
tft.setCursor(76, 150, 4); // Set cursor to x = 76, y = 150 and use font 4
tft.println("Transparent..."); // As we use println, the cursor moves to the next line
tft.setcursor(70, 175); // Set cursor to x = 70, y = 175
tft.setCursor(70, 175); // Set cursor to x = 70, y = 175
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set text colour to white and background to black
tft.println("White on black");
tft.setTextFont(4); // Select font 4 without moving cursor
tft.setcursor(00, 210); // Set cursor to x = 90, y = 210 without changing the font
tft.setCursor(00, 210); // Set cursor to x = 90, y = 210 without changing the font
tft.setTextColor(TFT_WHITE);
// By using the print class we can use all the formatting features like printing HEX

View File

@ -227,7 +227,7 @@ void jpegInfo() {
// The Due will work fine with the HX8357_Due library.
void showTime(uint32_t msTime) {
//tft.setcursor(0, 0);
//tft.setCursor(0, 0);
//tft.setTextFont(1);
//tft.setTextSize(2);
//tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -121,7 +121,7 @@ unsigned long testFillScreen() {
unsigned long testText() {
tft.fillScreen(TFT_BLACK);
unsigned long start = micros();
tft.setcursor(0, 0);
tft.setCursor(0, 0);
tft.setTextColor(TFT_WHITE); tft.setTextSize(1);
tft.println("Hello World!");
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);

View File

@ -17,7 +17,7 @@ void setup(void) {
tft.setRotation(3);
tft.fillScreen((0xFFFF));
tft.setcursor(20, 0, 2);
tft.setCursor(20, 0, 2);
tft.setTextColor(TFT_BLACK, TFT_WHITE); tft.setTextSize(1);
tft.println("calibration run");
@ -62,9 +62,9 @@ void loop() {
if (tft.getTouch(&x, &y)) {
tft.setcursor(5, 5, 2);
tft.setCursor(5, 5, 2);
tft.printf("x: %i ", x);
tft.setcursor(5, 20, 2);
tft.setCursor(5, 20, 2);
tft.printf("y: %i ", y);
tft.drawPixel(x, y, color);

View File

@ -161,7 +161,7 @@ void touch_calibrate()
} else {
// data not valid so recalibrate
tft.fillScreen(TFT_BLACK);
tft.setcursor(20, 0);
tft.setCursor(20, 0);
tft.setTextFont(2);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -171,7 +171,7 @@ void touch_calibrate()
} else {
// data not valid so recalibrate
tft.fillScreen(TFT_BLACK);
tft.setcursor(20, 0);
tft.setCursor(20, 0);
tft.setTextFont(2);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -254,7 +254,7 @@ void jpegInfo() {
// The Due will work fine with the HX8357_Due library.
void showTime(uint32_t msTime) {
//tft.setcursor(0, 0);
//tft.setCursor(0, 0);
//tft.setTextFont(1);
//tft.setTextSize(2);
//tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -27,11 +27,11 @@ void setup(void) {
void loop()
{
tft.fillRectHGradient(0, 0, 160, 50, TFT_MAGENTA, TFT_BLUE);
tft.setcursor(10,10);
tft.setCursor(10,10);
tft.print("Horizontal gradient");
tft.fillRectVGradient(0, 60, 160, 50, TFT_ORANGE, TFT_RED);
tft.setcursor(10,70);
tft.setCursor(10,70);
tft.print("Vertical gradient");
while(1) delay(100); // Wait here

View File

@ -31,7 +31,7 @@ void loop() {
/* Dessine la fractale */
draw_Julia(-0.8,+0.156,zoom);
tft.fillRect(0, 0, 150, 20, TFT_BLACK);
tft.setcursor(0,15);
tft.setCursor(0,15);
tft.setTextColor(TFT_WHITE);
tft.print(" Zoom = ");
tft.println(zoom);
@ -46,7 +46,7 @@ void loop() {
void draw_Julia(float c_r, float c_i, float zoom) {
tft.setcursor(0,0);
tft.setCursor(0,0);
float new_r = 0.0, new_i = 0.0, old_r = 0.0, old_i = 0.0;
/* Pour chaque pixel en X */

View File

@ -112,7 +112,7 @@ void loop() {
// Setting textDatum does nothing when using tft.print
tft.fillScreen(TFT_BLUE); // Clear screen
tft.setcursor(0,60); // To be compatible with Adafruit_GFX the cursor datum is always bottom left
tft.setCursor(0,60); // To be compatible with Adafruit_GFX the cursor datum is always bottom left
tft.print("âäàå"); // Using tft.print means text background is NEVER rendered
delay(2000);

View File

@ -144,7 +144,7 @@ void touch_calibrate()
} else {
// data not valid so recalibrate
tft.fillScreen(TFT_BLACK);
tft.setcursor(20, 0);
tft.setCursor(20, 0);
tft.setTextFont(2);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -162,7 +162,7 @@ void touch_calibrate()
} else {
// data not valid so recalibrate
tft.fillScreen(TFT_BLACK);
tft.setcursor(20, 0);
tft.setCursor(20, 0);
tft.setTextFont(2);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -84,7 +84,7 @@ void loop() {
tft.setTextFont(0); // Select font 0 which is the Adafruit font
tft.drawString("Original Adafruit font!", xpos, 5);
// The new larger fonts do not need to use the .setcursor call, coords are embedded
// The new larger fonts do not need to use the .setCursor call, coords are embedded
tft.setTextColor(TFT_BLACK); // Do not plot the background colour
// Overlay the black text on top of the rainbow plot (the advantage of not drawing the background colour!)

View File

@ -66,7 +66,7 @@ void touch_calibrate()
// Calibrate
tft.fillScreen(TFT_BLACK);
tft.setcursor(20, 0);
tft.setCursor(20, 0);
tft.setTextFont(2);
tft.setTextSize(1);
tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -134,7 +134,7 @@ unsigned long testFillScreen() {
unsigned long testText() {
tft.fillScreen(TFT_BLACK);
unsigned long start = micros();
tft.setcursor(0, 0);
tft.setCursor(0, 0);
tft.setTextColor(TFT_WHITE); tft.setTextSize(1);
tft.println("Hello World!");
tft.setTextColor(TFT_YELLOW); tft.setTextSize(2);

View File

@ -61,7 +61,7 @@ void loop() {
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set the font colour AND the background colour
// so the anti-aliasing works
tft.setcursor(0, 0); // Set cursor at top left of screen
tft.setCursor(0, 0); // Set cursor at top left of screen
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@ -102,7 +102,7 @@ void loop() {
// Get ready for the next demo while we have this font loaded
tft.fillScreen(TFT_BLACK);
tft.setcursor(0, 0); // Set cursor at top left of screen
tft.setCursor(0, 0); // Set cursor at top left of screen
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.println("Wrong and right ways to");
tft.println("print changing values...");
@ -121,17 +121,17 @@ void loop() {
// Draw changing numbers - does not work unless a filled rectangle is drawn over the old text
for (int i = 0; i <= 99; i++)
{
tft.setcursor(50, 50);
tft.setCursor(50, 50);
tft.setTextColor(TFT_GREEN, TFT_BLACK); // TFT_BLACK is used for anti-aliasing only
// By default background fill is off
tft.print(" "); // Overprinting old number with spaces DOES NOT WORK!
tft.setcursor(50, 50);
tft.setCursor(50, 50);
tft.print(i / 10.0, 1);
// Adding a parameter "true" to the setTextColor() function fills character background
// This extra parameter is only for smooth fonts!
tft.setTextColor(TFT_GREEN, TFT_BLACK, true);
tft.setcursor(50, 90);
tft.setCursor(50, 90);
tft.print(i / 10.0, 1);
delay (200);
@ -147,7 +147,7 @@ void loop() {
tft.setTextColor(TFT_YELLOW, TFT_BLACK); // Change the font colour and the background colour
tft.setcursor(0, 0); // Set cursor at top left of screen
tft.setCursor(0, 0); // Set cursor at top left of screen
tft.println("Large font!");

View File

@ -81,7 +81,7 @@ void loop() {
spr.setTextColor(TFT_YELLOW, TFT_BLACK); // Set the sprite font colour and the background colour
tft.setcursor(xpos - 50, ypos); // Set the tft cursor position, yes tft position!
tft.setCursor(xpos - 50, ypos); // Set the tft cursor position, yes tft position!
spr.printToSprite("Small 15pt font"); // Prints to tft cursor position, tft cursor NOT moved
ypos += spr.fontHeight(); // Get the font height and move ypos down
@ -100,14 +100,14 @@ void loop() {
spr.setTextColor(TFT_WHITE, TFT_BLUE); // Set the font colour and the background colour
tft.setcursor(xpos - 90, ypos); // Set the tft cursor position
tft.setCursor(xpos - 90, ypos); // Set the tft cursor position
spr.printToSprite("36pt font"); // Text is rendered via a minimally sized sprite
ypos += spr.fontHeight(); // Get the font height and move ypos down
// Draw changing numbers - no flicker using this plot method!
for (int i = 0; i <= 200; i++) {
tft.setcursor(10, 10);
tft.setCursor(10, 10);
// Number is converted to String type by (String) (number)
spr.printToSprite(" " + (String) (i / 100.0) + " "); // Space padding helps over-write old numbers
delay (20);

View File

@ -60,7 +60,7 @@ void loop() {
// Set "cursor" at top left corner of display (0,0)
// (cursor will move to next line automatically during printing with 'tft.println'
// or stay on the line is there is room for the text with tft.print)
tft.setcursor(0, 0);
tft.setCursor(0, 0);
// Set the font colour to be white with a black background, set text size multiplier to 1
tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -83,7 +83,7 @@ void loop() {
fillGradient(); // Put here after selecting the font so fontHeight() is already set
tft.setTextColor(TFT_WHITE); // Background color is ignored in gradient area
tft.setcursor(0, 10); // Set cursor at top left of screen
tft.setCursor(0, 10); // Set cursor at top left of screen
uint32_t t = millis();
tft.println(" Ode to a small\n lump of green\n putty I found\n in my armpit\n one midsummer\n morning ");

View File

@ -61,7 +61,7 @@ void loop() {
tft.loadFont(AA_FONT_SMALL);
tft.setTextColor(TFT_BLACK, TFT_WHITE); // Background color is ignored if callback is set
tft.setcursor(0, 10); // Set cursor at top left of screen
tft.setCursor(0, 10); // Set cursor at top left of screen
uint32_t t = millis();
tft.println(" Ode to a small\n lump of green\n putty I found\n in my armpit\n one midsummer\n morning ");

View File

@ -77,7 +77,7 @@ void loop()
tft.showFont(2000); // Note: This function moves the cursor position!
tft.fillScreen(bg);
tft.setcursor(0,0);
tft.setCursor(0,0);
tft.println(test1);
@ -99,7 +99,7 @@ void loop()
tft.showFont(2000); // Note: This function moves the cursor position!
tft.fillScreen(bg);
tft.setcursor(0,0);
tft.setCursor(0,0);
tft.setTextColor(TFT_CYAN, bg);
tft.println(test2);
@ -129,7 +129,7 @@ void loop()
tft.fillScreen(bg);
tft.setTextColor(TFT_GREEN, bg);
tft.setcursor(0,0);
tft.setCursor(0,0);
tft.println("Konnichiwa");
tft.println(test3);

View File

@ -80,7 +80,7 @@ void loop() {
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set the font colour AND the background colour
// so the anti-aliasing works
tft.setcursor(0, 0); // Set cursor at top left of screen
tft.setCursor(0, 0); // Set cursor at top left of screen
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@ -120,7 +120,7 @@ void loop() {
// Get ready for the next demo while we have this font loaded
tft.fillScreen(TFT_BLACK);
tft.setcursor(0, 0); // Set cursor at top left of screen
tft.setCursor(0, 0); // Set cursor at top left of screen
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.println("Wrong and right ways to");
tft.println("print changing values...");
@ -139,17 +139,17 @@ void loop() {
// Draw changing numbers - does not work unless a filled rectangle is drawn over the old text
for (int i = 0; i <= 20; i++)
{
tft.setcursor(50, 50);
tft.setCursor(50, 50);
tft.setTextColor(TFT_GREEN, TFT_BLACK); // TFT_BLACK is used for anti-aliasing only
// By default background fill is off
tft.print(" "); // Overprinting old number with spaces DOES NOT WORK!
tft.setcursor(50, 50);
tft.setCursor(50, 50);
tft.print(i / 10.0, 1);
// Adding a parameter "true" to the setTextColor() function fills character background
// This extra parameter is only for smooth fonts!
tft.setTextColor(TFT_GREEN, TFT_BLACK, true);
tft.setcursor(50, 90);
tft.setCursor(50, 90);
tft.print(i / 10.0, 1);
delay (200);
@ -165,7 +165,7 @@ void loop() {
tft.setTextColor(TFT_YELLOW, TFT_BLACK); // Change the font colour and the background colour
tft.setcursor(0, 0); // Set cursor at top left of screen
tft.setCursor(0, 0); // Set cursor at top left of screen
tft.println("Large font!");

View File

@ -102,7 +102,7 @@ void loop() {
spr.setTextColor(TFT_YELLOW, TFT_BLACK); // Set the sprite font colour and the background colour
tft.setcursor(xpos - 50, ypos); // Set the tft cursor position, yes tft position!
tft.setCursor(xpos - 50, ypos); // Set the tft cursor position, yes tft position!
spr.printToSprite("Small 15pt font"); // Prints to tft cursor position, tft cursor NOT moved
ypos += spr.fontHeight(); // Get the font height and move ypos down
@ -121,14 +121,14 @@ void loop() {
spr.setTextColor(TFT_WHITE, TFT_BLUE); // Set the font colour and the background colour
tft.setcursor(xpos - 90, ypos); // Set the tft cursor position
tft.setCursor(xpos - 90, ypos); // Set the tft cursor position
spr.printToSprite("36pt font"); // Text is rendered via a minimally sized sprite
ypos += spr.fontHeight(); // Get the font height and move ypos down
// Draw changing numbers - no flicker using this plot method!
for (int i = 0; i <= 200; i++) {
tft.setcursor(10, 10);
tft.setCursor(10, 10);
// Number is converted to String type by (String) (number)
spr.printToSprite(" " + (String) (i / 100.0) + " "); // Space padding helps over-write old numbers
delay (20);

View File

@ -78,7 +78,7 @@ void loop() {
// Set "cursor" at top left corner of display (0,0)
// (cursor will move to next line automatically during printing with 'tft.println'
// or stay on the line is there is room for the text with tft.print)
tft.setcursor(0, 0);
tft.setCursor(0, 0);
// Set the font colour to be white with a black background, set text size multiplier to 1
tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -108,7 +108,7 @@ void loop() {
fillGradient(); // Put here after selecting the font so fontHeight() is already set
tft.setTextColor(TFT_WHITE); // Background color is ignored in gradient area
tft.setcursor(0, 10); // Set cursor at top left of screen
tft.setCursor(0, 10); // Set cursor at top left of screen
uint32_t t = millis();
tft.println(" Ode to a small\n lump of green\n putty I found\n in my armpit\n one midsummer\n morning ");

View File

@ -88,7 +88,7 @@ void loop() {
tft.loadFont(AA_FONT_SMALL, LittleFS);
tft.setTextColor(TFT_BLACK, TFT_WHITE); // Background color is ignored if callback is set
tft.setcursor(0, 10); // Set cursor at top left of screen
tft.setCursor(0, 10); // Set cursor at top left of screen
uint32_t t = millis();
tft.println(" Ode to a small\n lump of green\n putty I found\n in my armpit\n one midsummer\n morning ");

View File

@ -82,7 +82,7 @@ void loop()
tft.showFont(2000); // Note: This function moves the cursor position!
tft.fillScreen(bg);
tft.setcursor(0,0);
tft.setCursor(0,0);
tft.println(test1);
@ -104,7 +104,7 @@ void loop()
tft.showFont(2000); // Note: This function moves the cursor position!
tft.fillScreen(bg);
tft.setcursor(0,0);
tft.setCursor(0,0);
uint32_t dt = millis();
tft.setTextColor(TFT_CYAN, bg);
tft.println(test2);
@ -134,7 +134,7 @@ dt = millis();
Serial.println(millis()-dt);
tft.fillScreen(bg);
tft.setTextColor(TFT_GREEN, bg);
tft.setcursor(0,0);
tft.setCursor(0,0);
dt = millis();
tft.println("Konnichiwa");
tft.println(test3);

View File

@ -103,7 +103,7 @@ void loop() {
// Set "cursor" at top left corner of display (0,0)
// (cursor will move to next line automatically during printing with 'tft.println'
// or stay on the line is there is room for the text with tft.print)
tft.setcursor(0, 0);
tft.setCursor(0, 0);
// Set the font colour to be white with a black background, set text size multiplier to 1
tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -81,7 +81,7 @@ void loop() {
tft.setTextColor(TFT_WHITE, TFT_BLACK); // Set the font colour AND the background colour
// so the anti-aliasing works
tft.setcursor(0, 0); // Set cursor at top left of screen
tft.setCursor(0, 0); // Set cursor at top left of screen
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@ -121,7 +121,7 @@ void loop() {
// Get ready for the next demo while we have this font loaded
tft.fillScreen(TFT_BLACK);
tft.setcursor(0, 0); // Set cursor at top left of screen
tft.setCursor(0, 0); // Set cursor at top left of screen
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.println("Wrong and right ways to");
tft.println("print changing values...");
@ -140,17 +140,17 @@ void loop() {
// Draw changing numbers - does not work unless a filled rectangle is drawn over the old text
for (int i = 0; i <= 20; i++)
{
tft.setcursor(50, 50);
tft.setCursor(50, 50);
tft.setTextColor(TFT_GREEN, TFT_BLACK); // TFT_BLACK is used for anti-aliasing only
// By default background fill is off
tft.print(" "); // Overprinting old number with spaces DOES NOT WORK!
tft.setcursor(50, 50);
tft.setCursor(50, 50);
tft.print(i / 10.0, 1);
// Adding a parameter "true" to the setTextColor() function fills character background
// This extra parameter is only for smooth fonts!
tft.setTextColor(TFT_GREEN, TFT_BLACK, true);
tft.setcursor(50, 90);
tft.setCursor(50, 90);
tft.print(i / 10.0, 1);
delay (200);
@ -166,7 +166,7 @@ void loop() {
tft.setTextColor(TFT_YELLOW, TFT_BLACK); // Change the font colour and the background colour
tft.setcursor(0, 0); // Set cursor at top left of screen
tft.setCursor(0, 0); // Set cursor at top left of screen
tft.println("Large font!");

View File

@ -102,7 +102,7 @@ void loop() {
spr.setTextColor(TFT_YELLOW, TFT_BLACK); // Set the sprite font colour and the background colour
tft.setcursor(xpos - 50, ypos); // Set the tft cursor position, yes tft position!
tft.setCursor(xpos - 50, ypos); // Set the tft cursor position, yes tft position!
spr.printToSprite("Small 15pt font"); // Prints to tft cursor position, tft cursor NOT moved
ypos += spr.fontHeight(); // Get the font height and move ypos down
@ -121,14 +121,14 @@ void loop() {
spr.setTextColor(TFT_WHITE, TFT_BLUE); // Set the font colour and the background colour
tft.setcursor(xpos - 90, ypos); // Set the tft cursor position
tft.setCursor(xpos - 90, ypos); // Set the tft cursor position
spr.printToSprite("36pt font"); // Text is rendered via a minimally sized sprite
ypos += spr.fontHeight(); // Get the font height and move ypos down
// Draw changing numbers - no flicker using this plot method!
for (int i = 0; i <= 200; i++) {
tft.setcursor(10, 10);
tft.setCursor(10, 10);
// Number is converted to String type by (String) (number)
spr.printToSprite(" " + (String) (i / 100.0) + " "); // Space padding helps over-write old numbers
delay (20);

View File

@ -80,7 +80,7 @@ void loop() {
// Set "cursor" at top left corner of display (0,0)
// (cursor will move to next line automatically during printing with 'tft.println'
// or stay on the line is there is room for the text with tft.print)
tft.setcursor(0, 0);
tft.setCursor(0, 0);
// Set the font colour to be white with a black background, set text size multiplier to 1
tft.setTextColor(TFT_WHITE, TFT_BLACK);

View File

@ -109,7 +109,7 @@ void loop() {
fillGradient(); // Put here after selecting the font so fontHeight() is already set
tft.setTextColor(TFT_WHITE); // Background color is ignored in gradient area
tft.setcursor(0, 10); // Set cursor at top left of screen
tft.setCursor(0, 10); // Set cursor at top left of screen
uint32_t t = millis();
tft.println(" Ode to a small\n lump of green\n putty I found\n in my armpit\n one midsummer\n morning ");

View File

@ -88,7 +88,7 @@ void loop() {
tft.loadFont(AA_FONT_SMALL);
tft.setTextColor(TFT_BLACK, TFT_WHITE); // Background color is ignored if callback is set
tft.setcursor(0, 10); // Set cursor at top left of screen
tft.setCursor(0, 10); // Set cursor at top left of screen
uint32_t t = millis();
tft.println(" Ode to a small\n lump of green\n putty I found\n in my armpit\n one midsummer\n morning ");

View File

@ -77,7 +77,7 @@ void loop()
tft.showFont(2000); // Note: This function moves the cursor position!
tft.fillScreen(bg);
tft.setcursor(0,0);
tft.setCursor(0,0);
tft.println(test1);
@ -99,7 +99,7 @@ void loop()
tft.showFont(2000); // Note: This function moves the cursor position!
tft.fillScreen(bg);
tft.setcursor(0,0);
tft.setCursor(0,0);
tft.setTextColor(TFT_CYAN, bg);
tft.println(test2);
@ -129,7 +129,7 @@ void loop()
tft.fillScreen(bg);
tft.setTextColor(TFT_GREEN, bg);
tft.setcursor(0,0);
tft.setCursor(0,0);
tft.println("Konnichiwa");
tft.println(test3);

View File

@ -172,7 +172,7 @@ void ringMeter(int x, int y, int r, int val, const char *units)
if (val < 10) dx = ofr.getTextWidth("4"); // Adjust cursor x for 1 digit
while ((uint8_t)str_buf[ptr] != 0) ptr++; // Count the characters
while (ptr) {
ofr.setcursor(w - dx - w / 20, -h / 2.5); // Offset cursor position in sprite
ofr.setCursor(w - dx - w / 20, -h / 2.5); // Offset cursor position in sprite
ofr.rprintf(str_buf + ptr - 1); // Draw a character
str_buf[ptr - 1] = 0; // Replace character with a null
dx += 1 + w / 3; // Adjust cursor for next character
@ -185,7 +185,7 @@ void ringMeter(int x, int y, int r, int val, const char *units)
ofr.setDrawer(tft);
ofr.setFontColor(TFT_GOLD, DARKER_GREY);
ofr.setFontSize(r / 2.0);
ofr.setcursor(x, y + (r * 0.4));
ofr.setCursor(x, y + (r * 0.4));
ofr.cprintf("Watts");
}
#endif

View File

@ -11,7 +11,7 @@ void setup(void) {
void loop() {
tft.fillScreen(TFT_BLACK);
tft.setcursor(0, 0);
tft.setCursor(0, 0);
// Draw some random smooth rounded rectangles
for (int i = 0; i < 20; i++)
@ -30,7 +30,7 @@ void loop() {
delay(2000);
tft.fillScreen(TFT_BLACK);
tft.setcursor(0, 0);
tft.setCursor(0, 0);
// Draw some random minimum thickness smooth rounded rectangles
for (int i = 0; i < 20; i++)