Stop a while loop by pressing the touch display

Gary

Active member
Hi

I have a question and I'm not able to find the solution for myself. Maybe someone can tell me the way to the right solution.....

I have a Teensy 4.0 and a Display which is working well with the ILI9488_t3 library.

In one part of my scetch I have a while loop. Now I need a way to stop this while loop by pressing the display.

For example:

while (xyz == 0) {

display.print("Hallo");

delay (50);

}

Thanks a lot for your help. :)

Greetings
Gary
 
Can you run this example? >> "...\libraries\ILI9488_t3\examples\breakouttouchpaint\breakouttouchpaint.ino"

Looking at:
Code:
void loop()
{
  // Retrieve a point 
  TSPoint p = ts.getPoint();

//...
 
  // we have some minimum pressure we consider 'valid'
  // pressure of 0 means no pressing!
  if (p.z < MINPRESSURE || p.z > MAXPRESSURE) {
     return;
  }
  ...

Using that - perhaps do something like:
Code:
while (xyz == 0) {
  TSPoint p = ts.getPoint();
  if ( !(p.z < MINPRESSURE || p.z > MAXPRESSURE) ) {
     break;
  }
display.print("Hallo");

delay (50);

}
 
p#2 or p#3 should work. Looking at the example the 'reject bad touch' was used ... not had this active for some time and wasn't sure if a bogus touch would come through. Or how often it is proper to call that ...

The only issue might be the delay(50); not sampling often enough if a spurious touch blocks a valid touch and doesn't get tested.
 
Thanks for your replied. This was only an example with the 'delay'.

I will try it later. But I think there are very good ideas.

Greetings
 
Back
Top