Advertisement
jcdj1996

NXJ Marble Gun

Dec 13th, 2012
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.45 KB | None | 0 0
  1. import lejos.nxt.Button;
  2. import lejos.nxt.Motor;
  3.  
  4. public class first1 {
  5.   public static void main (String[] args) {
  6.      
  7.         fire();
  8.   }
  9.   public static void fire() //fire marble gun (360 degree rotation on Motor A)
  10.   {
  11.       Button.waitForAnyPress();
  12.       if(Button.ENTER.isDown())     //if enter is pressed, fire
  13.       {
  14.           Motor.A.rotate(360);
  15.       }
  16.       if(!Button.ESCAPE.isDown())   //if escape is pressed, exit program
  17.       {
  18.          fire();
  19.       }  
  20.   }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement