View Single Post
  #2   Spotlight this post!  
Unread 25-05-2015, 17:41
PAR_WIG1350's Avatar
PAR_WIG1350 PAR_WIG1350 is offline
Registered User
AKA: Alan Wells
FRC #1350 (Rambots)
Team Role: Alumni
 
Join Date: Dec 2009
Rookie Year: 2009
Location: Rhode Island
Posts: 1,189
PAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond reputePAR_WIG1350 has a reputation beyond repute
Re: Need help with lego NXT lejos xbox controlling

Quote:
Originally Posted by TheModMaster8 View Post
Code:
		while(true)
		{
			control.poll();
		    //Start=control.isButtonPressed(7);
			/**System.out.print(control.getAxisValue(0));
			System.out.print("   ");
			System.out.print(control.getAxisValue(1));
			System.out.print("   ");
			System.out.print(control.getAxisValue(2));
			System.out.print("   ");
			System.out.print(control.getAxisValue(3));
			System.out.print("   ");
			System.out.print(control.getAxisValue(4));
			System.out.print("   ");
			System.out.print(control.getAxisValue(5));
			System.out.println(); */
			Virtual_JoyStick joy = new Virtual_JoyStick();
			joy.repaint();
	        }
I'm not sure what each line of this is doing, but assuming those are the correct methods, all you have to do is assign their values to variables instead of printing them (see below). From there, you need to figure out how you are getting the commands from the computer to the NXT. For this you would want to also include a bluetooth library on the computer side. I would imagine that Lejos has methods for bluetooth on the NXT side.

Code:
                     axisZero = control.getAxisValue(0);
Hope that helps.

EDIT: what do the last 2 lines of the while loop do? it seems like that might not be something you want to do for every iteration of the loop, but I could be wrong.

EDIT (again): I see that the constructor called in the lines I referenced above is the constructor for the parent class. Is the start class the class that you are using to run the program in the JVM, or is it a class that you intend to use to create start objects? I assumed the former since you omitted a constructor but included a main() method, but it occurred to me that you might have intended the latter.
__________________

Last edited by PAR_WIG1350 : 25-05-2015 at 17:52.