I'm attempting to use an Xbox One wired controller on my MacBook Pro laptop, Im using Java with Eclipse that has lejos and LWJGL installed on it in order to control an NXT via my controller, like how we control our robots. I have a gamepad driver installed, it's called "XOne Controller" (link)
https://github.com/FranticRain/Xone-OSX Also i have a little program to test the data from the joysticks and buttons of the controller
Code:
import org.lwjgl.LWJGLException;
import org.lwjgl.input.Controller;
import org.lwjgl.input.Controllers;
public class Start extends Virtual_JoyStick
{
public static Controller control;
public static boolean Start;
public static void main(String[] args)
{
try
{
Controllers.create();
}
catch(LWJGLException e)
{
e.printStackTrace();
}
Controllers.poll();
for(int i=0;i<Controllers.getControllerCount();i++)
{
control=Controllers.getController(i);
System.out.print(control.getName());
}
control=Controllers.getController(0);
for(int i=0; i < control.getAxisCount(); i++)
{
System.out.print(i+ ": "+ control.getAxisName(i));
//System.out.print("c");
control.setDeadZone(i, (float) 0.30);
}
for(int i=0; i < control.getButtonCount(); i++)
{
System.out.print(i+ ": "+ control.getButtonName(i));
}
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();
}
}
}
my problem is i don't know how to make the main program listen to live input data and send it to the robot wirelessly, Also note that I'm not at basic but not advanced in the realms of coding. JSYK (just so you know).