Skip to content

Instantly share code, notes, and snippets.

@DapperFox
Created May 20, 2014 22:43
Show Gist options
  • Save DapperFox/9fef86edf6e7a6adc956 to your computer and use it in GitHub Desktop.
Save DapperFox/9fef86edf6e7a6adc956 to your computer and use it in GitHub Desktop.
Touch Listnere
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