Ok, I figured out the problem. For all the rest of you that get this exception, it's because every CoolieHat (D-Pad) is also a ControllButton, but not every ControllButton is a ControllCoolieHat in PControll. You have to use ControllDevice.printButtons() to find out what the number of the button is that is called a cooliehat is, and then you have to call ControllDevice.getCoolieHat( # ) where # is the number of the button that you identified as a cooliehat from ControllDevice.printButtons(). If you have the wrong #, then you'll get that error.
It's NOT a linux problem at all - I have all the buttons, sticks, sliders, and cooliehats working on the RumblePad 2 USB in ubuntu 9.0.4.
Example:
Quote:import procontroll.*;
// works with ubuntu 9.0.4
String deviceName = "Logitech Logitech RumblePad 2 USB";
ControllIO controllIO;
ControllDevice device;
ControllButton[] buttons;
ControllSlider[] sliders;
ControllStick[] sticks;
ControllCoolieHat cooliehat;
int buttonHeight;
int sliderWidth;
int sliderHeight;
void setup() {
size( 300, 300 );
controllIO = ControllIO.getInstance( this );
device = controllIO.getDevice( deviceName );
device.setTolerance( 0.05 );
int numButtons = device.getNumberOfButtons();
int numSliders = device.getNumberOfSliders();
int numSticks = device.getNumberOfSticks();
buttons = new ControllButton[numButtons];
sliders = new ControllSlider[numSliders];
sticks = new ControllStick[numSticks];
for( int i = 0; i < buttons.length; i++ ) {
buttons[i] = device.getButton(i);
}
for( int i = 0; i < sliders.length; i++ ) {
sliders[i] = device.getSlider(i);
}
for( int i = 0; i < sticks.length; i++ ) {
sticks[i] = new ControllStick( sliders[2*i], sliders[2*i+1] );
}
cooliehat = device.getCoolieHat(12);
buttonHeight = height / buttons.length;
sliderWidth = ( width / 2 ) / sliders.length;
sliderHeight = height / 2;
}
void draw() {
stroke( 0 );
background( 0 );
for( int i = 0; i < buttons.length; i++ ) {
if( buttons[i].pressed() ) {
fill( 255, 0, 0 );
}
else {
fill( 0 );
}
rect( 0, buttonHeight * i, width/2, buttonHeight );
}
stroke( 255 );
fill( 0 );
for( int i = 0; i < sliders.length; i++ ) {
rect( width/2 + i * sliderWidth,
sliderHeight*( 1 - sliders[i].getValue() ),
sliderWidth,
sliderHeight * sliders[i].getValue()
);
}
pushStyle();
pushMatrix();
strokeWeight( 20 );
stroke( 255, 255, 0 );
translate( width/2, height/2 );
line( 0, 0, width/4 * cooliehat.getX(), width/4 * cooliehat.getY() );
popMatrix();
popStyle();
}