Reputation: 211
I am currently using loops with the finch robot to test some java codes and have come across an error. Here is my code.
import edu.cmu.ri.createlab.terk.robot.finch.Finch;
public class CS1702_Lab4 {
public static void main (String[] args) throws Exception
{
Finch myf = new Finch();
myf.setWheelVelocities(100,100);
long before = System.currentTimeMillis();{
while(System.currentTimeMillis() - before < 5000)
{
Thread.sleep(500);
if (myf.isTapped()) break;
}
myf.stopWheels();
myf.quit();
}
}
On line "myf.setWheelVelocities(100,100)", I am getting the following error;
Any help towards solving this error is appreciated. Many thanks.
Upvotes: 1
Views: 1767
Reputation: 1
It might be too late now, but this piece of code
myf.setWheelVelocities(100,100);
should have 3 sets of numbers e.g.
myf.setWheelVelocities(100,100,5000);
Upvotes: 0
Reputation: 3822
you have too many brackets { }
remove them in these lines:
long before = System.currentTimeMillis();{
and here:
myf.quit();
}
Also it seems as if you have no class declaration.
public class CS1702_Lab4 {
public static void main (String[] args) throws Exception
{
Finch myf = new Finch();
myf.setWheelVelocities(100,100);
long before = System.currentTimeMillis();
while(System.currentTimeMillis() - before < 5000)
{
Thread.sleep(500);
if (myf.isTapped()) break;
}
myf.stopWheels();
myf.quit();
}
}
Upvotes: 2