So I'm fairly new at everything arduino, including the TFT touch screen by Adafruit... I'm trying to program some touch options, and so far so good, I've been doing baby steps and troubleshooting as I go... Up until this point I've been doing okay.
I've tried to update analog input paramaters on the screen, and so far the only way that I can find to draw the numbers on the display is to do a tft.setCursor followed by a tft.println. (any better way of doing this??)
The section of code that I use is as follows and is in the void loop (){ section.
for (scans = 0; scans < 10; scans ++) {
if (scans < 10) {
continue;
}
else {
scans = 0;
// DATA REFRESH ROUTINE
// Keeps data up to date on the current page
#define bagpage_x 133
#define bagpage_y1 25
#define bagpage_y2 85
if (page == 1) {
tft.setTextSize(5);
tft.setTextColor(MAGENTA);
tft.setCursor(bagpage_x, bagpage_y1);
tft.println(lfactual);
tft.setCursor(bagpage_x, bagpage_y2);
tft.println(lfpress);
}
if (page == 2) {
tft.setTextSize(5);
tft.setTextColor(MAGENTA);
tft.setCursor(bagpage_x, bagpage_y1);
tft.println(rfactual);
tft.setCursor(bagpage_x, bagpage_y2);
tft.println(rfpress);
}
if (page == 3) {
tft.setTextSize(5);
tft.setTextColor(MAGENTA);
tft.setCursor(bagpage_x, bagpage_y1);
tft.println(lractual);
tft.setCursor(bagpage_x, bagpage_y2);
tft.println(lrpress);
}
if (page == 4) {
tft.setTextSize(5);
tft.setTextColor(MAGENTA);
tft.setCursor(bagpage_x, bagpage_y1);
tft.println(rractual);
tft.setCursor(bagpage_x, bagpage_y2);
tft.println(rrpress);
}
if (page == 7) {
tft.setTextSize(3);
tft.setTextColor(WHITE);
tft.setCursor(13, 35);
tft.println(lfactual);
tft.setCursor(274, 35);
tft.println(rfactual);
tft.setCursor(140, 35);
tft.println(tankactual);
tft.setCursor(13, 94);
tft.println(lractual);
tft.setCursor(274, 94);
tft.println(rractual);
}
}}
Now... That being said... When I change screens the 'page' number changes, and that pulls up different data that maps to different parts of the applicable screen. Up until I added this bit of code, everything operated smoothly and quickly... But when I added the part from '//data refresh routine' on down, it was really slow. So my idea was to execute this code (and refresh the data) every tenth scan... I know I have to add a clear part to keep the numbers from piling up on top of each other, but like I said... baby steps.
Am I going about this all wrong? Is there a much easier way? I'm open to suggestions. Please keep everything straight forward and easy for me to wrap my mind around... I know, easier said than done. The main thing is that I'm trying to keep the other portion of the text ( the touch part) as responsive as possible. Are there any good guidelines on how to achieve this?