Instead of using Wait() you need to use Timer.delay(). The problem with Wait is that is a method on the Object class which is the base for all objects. So using wait doesn't really work.
First, be sure you have this import:
Code:
import edu.wpi.first.wpilibj.Timer;
Then, here is an example of using delay:
Code:
public void autonomous() {
System.out.println("In autonomous");
for (int i = 0; i < 40; i++) {
drivetrain.drive(1, 0.0);
Timer.delay(2); // wait 2 seconds
drivetrain.drive(-1, 0);
Timer.delay(2);
}
drivetrain.drive(0.0, 0.0); // drive 0% forward, 0% turn (stop)
}