I wrote a code for the finch robot in Java that should light up and say the name of the colour when it is tapped but at the moment when I tap nothing happens. It works without the if statement but when I add it nothing happens. Does anyone know why? Thank you
import edu.cmu.ri.createlab.terk.robot.finch.Finch;
import java.awt.Color;
public class FinchUserInteraction {
// create finch object
static Finch myFinch = new Finch();
public static void main(String[] args)
{
//'BlueFinch' is the name of the blue Finch object
myFinch = new Finch();
if (myFinch.isTapped() == true)
{
myFinch.setLED(Color.blue, 500);
myFinch.saySomething("Blue");
}
else
{
myFinch.setLED(Color.orange);
}
myFinch.quit();
System.exit(0);
}
}
Aucun commentaire:
Enregistrer un commentaire