We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I am trying to receive data from the controller, so I can later assign the joysticks and buttons serial commands to send to an arduino robot. To do so, after scouring the web, I came down to Processing and the ProControll library. After some library issues, namely finding 64 bit dlls, I began to test and see if this would work. I ran the example code from the library website that prints all devices, and it does recognize my controller. Now, when I try to run the print sticks example code, import procontroll.*; import java.io.*;
ControllIO controll;
ControllDevice device;
ControllStick stick;
ControllButton button;
void setup(){
size(400,400);
controll = ControllIO.getInstance(this);
device = controll.getDevice("Logitech RumblePad 2 USB");
device.printSticks();
device.setTolerance(0.05f);
ControllSlider sliderX = device.getSlider("X-Achse");
ControllSlider sliderY = device.getSlider("Y-Achse");
stick = new ControllStick(sliderX,sliderY);
button = device.getButton("Taste 0");
fill(0);
rectMode(CENTER);
}
float totalX = width/2;
float totalY = height/2;
void draw(){
background(255);
if(button.pressed()){
fill(255,0,0);
}else{
fill(0);
}
totalX = constrain(totalX + stick.getX(),10,width-10);
totalY = constrain(totalY + stick.getY(),10,height-10);
rect(totalX,totalY,20,20);
}
it throws a null pointer at the if statement and the Total* = statements. Why should this be, and how should one go around doing what I am set about to do and fix these issues in the code, that seems to have worked for others? ( Complete java noob by the way) I am really frustrated with this right now, as for such a simple with, interfacing with a gamepad, there is almost no information and running code online. All I want is to use a controller and send the button presses and stick movements to the arduino to process. How hard can it be?