I'd answer as a comment, but I don't think i can do that and make it readable..
My guess is that touch.isPressed()
is returning true without the sensor actually being pressed. The sensors are not overly reliable and it is possible that it isn't quite in an initialized state.
I'd change the code to look like this for now, just to debug the issue:
Motor.A.setSpeed(1000);
Motor.B.setSpeed(1000);
Motor.A.forward();
Motor.B.forward();
if(touch.isPressed())
{
LCD.drawString("Pressed", 3, 4);
}
else
{
LCD.drawString("NOT Pressed", 3, 4);
}
Button.waitForAnyPress();
// rest of your code
That way you can be 100% sure what isPressed
is returning.