CLEAR ALL
FOR n=0 TO 3
    IF GAMEPAD.ISCONNECTED(n) THEN EXIT FOR
NEXT n
IF n=4 THEN PRINT "No gamepad detected.":END
DO
    CLS
    PRINT "Gamepad "+STR$(n)
    PRINT
    PRINT GAMEPAD.THUMBSTICK(n,1) ' left X
    PRINT GAMEPAD.THUMBSTICK(n,2) ' left Y
    PRINT
    PRINT GAMEPAD.THUMBSTICK(n,3) ' right X
    PRINT GAMEPAD.THUMBSTICK(n,4) ' right Y
    PRINT
    PRINT GAMEPAD.DPAD(n)
    PRINT
    PRINT GAMEPAD.BUTTONS(n)
    PRINT
    PRINT GAMEPAD.TRIGGER(n,1)
    PRINT GAMEPAD.TRIGGER(n,2)
    PAUSE
LOOP UNTIL INKEY$=CHR$(27)
