Hallo leute,
folgendes Problem ich habe mehrere for-schleifen hintereinander laufen.
Gestäuert wird das ganze über ein Touchdisplay.
Nach druck auf start startet ein Programm welches verschiedene Steppper Schritte in for-Schleifen ausführt.
Nach druck auf start startet bei jedem zweiten durchgang der Loop () die nächste for schleife diese for schleifen möchte ich per touchscreen mittels break unterbrechen dies funktioniert auch anfangs nach der dritten oder vierten schleife reagiert der Touchscreen nicht mehr auf meinen Druck bzw der Stop button funktioniert nicht mehr. (Wenn ich lange auf stop draufbleibe funktioniert er ab und zu noch ich denke das es ein Problem mit der abfrage ob stop gedrückt ist oder nicht ist )
Kann mir jemand sagen woran das liegt?
Der Code ist ganz schön lang habe den teil um den es geht mit eingebunden
if (( i == 1) && (( p.x > 310 && p.x < 470) && (p.y > 240 && p.y < 320 ))) {
tft.fillRoundRect(330, 10, 140, 100, 10, GRAU);
tft.drawRoundRect(330, 10, 140, 100, 10, BLACK);
tft.setCursor(380, 45);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.print("In");
tft.setCursor(335, 65);
tft.setTextColor(BLACK);
tft.setTextSize(2);
tft.print("Bearbeitung");
digitalWrite(Ventil_AUF, LOW);
digitalWrite(Ventil_AB, HIGH);
digitalWrite(MS, HIGH);
digitalWrite(Wasserpumpe, HIGH);
//b=0;
// i++;
l=3;
digitalWrite(StepperStrom, HIGH);
}
}
if (l == 1) {
for (int schritt = 0; schritt <= 7000; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(110);
Motor.step(-1);
}
l++;
b=0;
}
if (l == 3) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt =0;
l=108;
break;
}
}
Motor.setSpeed(12.5 * X);
Motor.step(-1);
}
l++;
b=0;
}
if (l == 5) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(12.5 * X);
Motor.step(-1);
}
l++;
b=0;
}
if (l == 7) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(6.25 * X);
Motor.step(-1);
}
l++;
b=0;
}
if (l == 9) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(4.1675 * X);
Motor.step(-1);
}
l++;
b=0;
}
if (l == 11) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(3.125 * X);
Motor.step(-1);
}
l++;
}
if (l == 13) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(2.5 * X);
Motor.step(-1);
}
l++;
b=0;
}
if (l == 15) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(2.0825 * X);
Motor.step(-1);
}
l++;
b=0;
}
if (l == 17) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(1.785 * X);
Motor.step(-1);
}
l++;
b=0;
}
if (l == 19) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(1.5625 * X);
Motor.step(-1);
}
l++;
b=0;
}
if (l == 21) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(1.39 * X);
Motor.step(-1);
}
l++;
b=0;
}
if (l == 23) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(1.25 * X);
Motor.step(-1);
}
l++;
b=0;
}
if (l == 25) {
for (int schritt = 0; schritt <= 50; schritt++) {
if (p.z > MINPRESSURE && p.z < MAXPRESSURE) {
TSPoint p = ts.getPoint();
p.x = map(p.x, TS_MINX, TS_MAXX, tft.width(), 0);
p.y = map(p.y, TS_MINY, TS_MAXY, tft.height(), 0);
if ((( p.x > 0 && p.x < 120) && (p.y > 270 && p.y < 320 ))) {
schritt = 0;
l=108;
break;
}
}
Motor.setSpeed(1.1375 * X);
Motor.step(-1);
}
l++;
}
es folgen noch ein paar for schleifen insgesamt sind es ca. 50 for schleifen die alle so aufgebaut sind.