Hello everyone!
I have a 2.8 TFT touch screen.
I have a keyboard as wallpaper, and when I press the buttons, I want the numbers displayed one after the other, the concern is that I want to be able to show that 4 digits, when I press a single digit, it appears 4 times, whereas I want it to appear only once .. I do not think that silliness in my code ..
here is my code (I use that number 1 and 2 for the moment):
int press()
{
digitalWrite(13, HIGH);
Point p = ts.getPoint();
digitalWrite(13, LOW);
// if sharing pins, you'll need to fix the directions of the touchscreen pins
//pinMode(XP, OUTPUT);
pinMode(XM, OUTPUT);
pinMode(YP, OUTPUT);
int i = 0;
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
// scale from 0->1023 to tft.width
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
for(i = 0; i < 4; i++)
{
if (p.y >= 7 && p.y <= 65 && p.x >= 175 && p.x <= 231)
{
Serial.println("hello XY ");
bmpDraw("1.bmp", 14, Yfirst + i*Yafter);
}
if (p.y >= 71 && p.y <= 127 && p.x >= 175 && p.x <= 232)
{
Serial.println("hello X1Y1 ");
bmpDraw("2.bmp", 13, Yfirst + i*Yafter);
}
}
/*if(i = 3)
{
bmpDraw("tiger.bmp",0,0);
}
*/
}
}
If anyone can help me it would be cool!