most of joysticks come with drivers when you buy, but that doesn't mean you necessarily need that driver.
if you plug the joystick into the driver station, it'll most likely recognize the device without driver(unless the joystick really need driver).
you'll need WPILib to get information of joystick status, which can be interpreted as it is preconfigured.
you can assign specific functions to corresponding buttons by making if or switch case statements.
for example
Code:
int button[13]; // find which button is pushed
int a = 0; //how many buttons are pushed?
for(int i = 0; i < 12; i++){ //Get what button(s) is/are pushed and save it in array variable
if(Joystick::GetRawButton((i+1)) == TRUE){
button[a] = i;
a++;
}
}
for(int i = 0; i < a; i++){
switch(button[i+1]){
case 0: //if nothing is pushed
break;
case 1: //if button1 is pushed
DoThis();
break;
case 2: //if button2 is pushed
DoThat();
break;
case 3: //if button3 is pushed
DoThese();
break;
case 4: //if button4 is pushed
DoThose();
break;
case 5: //if button5 is pushed
DoIt();
break;
case 6: //if button6 is pushed
GoThere();
break;
case 7: //if button7 is pushed
ComeHere();
break;
case 8: //if button 8 is pushed
Shoot();
break;
case 9: //if button 9 is pushed
RunAway();
break;
case 10: //if button 10 is pushed
Stop();
break;
case 11: //if button 11 is pushed
DisableYourself();
break;
case 12: //if button 12 is pushed
AbortAndCatchOnFire();
break;
}
}
a = 0;
for(int i = 0; i < 12; i++){ //reset
button[i] = 0;
}
i think you can have up to 12 buttons and i doubt you'll assign all 12 buttons to its corresponding functions but that's one way to do it.
the other way is having a lot(depends on how many buttons you'll be assigning specific functions to) of if and else if statements
there might be other ways but I can't think of it at the moment