Created
May 20, 2014 22:43
-
-
Save DapperFox/9fef86edf6e7a6adc956 to your computer and use it in GitHub Desktop.
Touch Listnere
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package learnlejos; | |
import lejos.nxt.Motor; | |
/** | |
* Created by blakebishop on 5/20/14. | |
*/ | |
public class TouchListener implements ITouchListener { | |
private boolean direction = false; | |
public TouchListener() { | |
Motor.A.setSpeed(2000); | |
} | |
@Override | |
public void changeState() { | |
if(direction) { | |
Motor.A.forward(); | |
direction = !direction; | |
} | |
else { | |
Motor.A.backward(); | |
direction = !direction; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment