Sorted
void setup() {
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
pinMode(3, INPUT_PULLUP);
}
void loop() {
// read the digital inputs and set the buttons
Joystick.button(1, digitalRead(0) == LOW);
Joystick.button(2, digitalRead(1) == LOW);
Joystick.button(3, digitalRead(2) == LOW);
Joystick.button(4, digitalRead(3) == LOW);
// a brief delay, so this runs 20 times per second
delay(50);
}