XRAD
July 23, 2021, 11:04pm
1
Hi,
I am trying to display one char at a time on same line, just like someone is typing on a monitor.
I figure I need a string, and then to access the correct character from the string just once, and add it to the same line on the display.
I have tried many different configurations of code, but just getting goop...
display RA8875 processor, 480x272 display, teensy 3.6 . i can display the string
char string[15] = "Hello, World! ";
without issue......
Any Ideas?? THX!!
char string[15] = "Hello, World! ";
tft.textMode();
tft.textTransparent(RA8875_RED);
for (int x = 0; x < 15; x++) {
tft.textSetCursor(0, 100);
tft.textWrite(string[x]);
delay(250);
}
blh64
July 23, 2021, 11:25pm
2
You are repeatedly setting your cursor to the same spot so you are writing every char in that same spot.
Also, depending on what library you are using textWrite() may not be properly dealing with a 'char' if it is expecting a 'char *' What library are you using? (If using the Adafruit version, you can specify how many chars to print)
char string[15] = "Hello, World! ";
tft.textMode();
tft.textSetCursor(0, 100);
tft.textTransparent(RA8875_RED);
for (char *p = string; *p; p++) {
tft.textWrite(p, 1);
delay(250);
}
XRAD:
but just getting goop...
Describe what actually happens.
XRAD
July 24, 2021, 12:20am
4
blh64 THX!!
So I thought that setting the cursor to one spot, and then overwriting like
H (char [0])
He (char [1])
Hel
Hell
etc...
would work but which obviously seems wrong now that I type it out!
. But THANK YOU for the 'pointers!' That bit of code works GREAT.
so instead with your code I am displaying:
char 0,1,2,3,4...etc
so what does this do? does it force a space to the next character?
tft.textWrite(p, 1);
jremington...above code works great now.
blh64
July 24, 2021, 3:55pm
5
you can overwrite existing chars, but in that case, you want to specify how many chars to print...
for (int x = 0; x < 15; x++) {
tft.textSetCursor(0, 100);
tft.textWrite(string, x);
delay(250);
}
system
Closed
November 21, 2021, 3:56pm
6
This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.