Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 20:06 27 Mar 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : USB Gamepads - please help

     Page 1 of 3    
Author Message
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9800
Posted: 02:32pm 25 Feb 2025
Copy link to clipboard 
Print this post

If you can run any of the USB variants of the firmware and have any sort of Gamepad please help get it supported by MMBasic

Here are USB variants of V6.00.00b12


PicoMiteUSBV6.00.02b12.zip


If you load this firmware and plug your gamepad in you may see a message "Generic Gamepad Connected on channel 3". If so then your gamepad is supported and should work properly.

If not then we need to add your gamepad to the configuration so please do the following.

Unplug the gamepad and reboot. Then run the attached Basic program following the instructions exactly. If this works then you should get a printout with some C configuration code and then a (long) Basic command. These are listings of two files
gamepad.txt and gamepadsetup.bas which will be saved on the A: drive.

Post the contents of gamepad.txt to this thread and I will add the configuration to the MMBasic firmware

To use your gamepad in the interim do the following:
Unplug the gamepad
Reboot
Run the program gamepadsetup.bas
plug in your gamepad and it should now be recognised and work.

Note that the configuration will last until the Pico is rebooted so after each reboot you will need to run the program again WITHOUT the gamepad plugged in.

Do While Inkey$<>"":Loop
Print "Make sure the gamepad is unplugged"
Print "press a key when ready"
Do While Inkey$ = "" : Loop
Gamepad monitor
Print "Plug in the gampad and make sure no buttons are pressed"
Pause 2000
Print "press a key when ready"
Do While Inkey$ = "" : Loop
nothing$=DEVICE(gamepad 3,raw)
Open "gamepad.txt" For output As #1
Open "gamepadsetup.bas" For output As #2
Print #1,"{"
Print #1,"     .vid=0x"+Hex$(MM.Info(usb vid 3))+",";
Print #1,".pid=0x"+Hex$(MM.Info(usb pid 3))+","
Print #2, "gamepad configure &H"+Hex$(MM.Info(usb vid 3))+",&H";
Print #2, Hex$(MM.Info(usb pid 3))+",";
Print "We are now going to step through the 16 possible buttons on the gamepad"
Print "If your gamepad does not have the button requested just press any key to continue"
button "R1"
button "START"
button "HOME"
button "SELECT"
button "L1"
button "DOWN"
button "RIGHT"
button "UP"
button "LEFT"
button "R2"
button "X"
button "A"
button "Y"
button "B"
button "L2"
button "TOUCH"
Print #1,"},"
Close 1
Close 2
List "gamepad.txt"
List "gamepadsetup.bas"
End
'
Sub button name$
 Local code$=".b_"+name$
 Print ""
 Print "Press and hold the "+name$+" button then press any key"
 Do While Inkey$ = "" : Loop
 b$=DEVICE(gamepad 3,raw)
 If b$<> nothing$ Then
   changed nothing$,b$,code$+"={"
   Do
     b$= DEVICE(gamepad 3,raw)
   Loop Until b$=nothing$
 Else
   If Instr(code$,"TOUCH") Then
     Print #1,"    "+code$+"={255,0}"
     Print #2,"255,0"
   Else
     Print #1,"    "+code$+"={255,0},"
     Print #2,"255,0,";
   EndIf
 EndIf
End Sub
'
Sub changed last$,now$,code$
 Local inp%,outp%,baseline%,i%, bit%, up%
 For i%=1 To Len(last$)
   Inp%=Asc(Mid$(last$,i%,1))
   Outp%=Asc(Mid$(now$,i%,1))
   baseline%=Asc(Mid$(nothing$,i%,1))
   If inp%<>outp% Then
     Print #1,"    "+code$;
     If baseline%>=&H7f And baseline%<=&H81 Then
       If bits(inp%,outp%) Then
         Print #1,Str$(i%-1)+","+Str$(Choice(outp%>inp%,192,64));
         Print #2,Str$(i%-1)+","+Str$(Choice(outp%>inp%,192,64));
       EndIf
     Else If bits(inp%,outp%)=1 Then
       bitchanged inp%, outp%, bit%, up%
       Print #1,Str$(i%-1)+","+Str$(Choice(up%=1,bit%+128,bit%));
       Print #2,Str$(i%-1)+","+Str$(Choice(up%=1,bit%+128,bit%));
     EndIf
     If Instr(code$,"TOUCH") Then
       Print #1,"}"
       Print #2,""
     Else
       Print #1,"},"
       Print #2,",";
     EndIf
   EndIf
 Next

End Sub
'
Sub bitchanged a%,b%,bn%,which%
 Local i%,j%=a% Xor b%
 For bn%=0 To 7
   If j% And (1<<bn%) Then
     If a% And (1<<bn%) Then which%=1 Else which%=2
     Exit Sub
   EndIf
 Next
End Sub
'
Function bits(a%,b%) As integer
 Local n%=0,i%=a% Xor b%
 Do While(i%)
   Inc n%,i% And 1
   i%=i%>>1
 Loop
 bits=n%
End Function


Example operation
Make sure the gamepad is unplugged
press a key when ready
Plug in the gampad and make sure no buttons are pressed
press a key when ready
Generic Gamepad Connected on channel 3
081F,E401
00,00,00,00,00,00,00,00
7F,7F,00,80,80,0F,00,00
We are now going to step through the 16 possible buttons on the gamepad
If your gamepad does not have the button requested just press any key to continue

Press and hold the R1 button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
7F,7F,00,80,80,0F,02,00
081F,E401
7F,7F,00,80,80,0F,02,00
7F,7F,00,80,80,0F,00,00

Press and hold the START button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
7F,7F,00,80,80,0F,20,00
081F,E401
7F,7F,00,80,80,0F,20,00
7F,7F,00,80,80,0F,00,00

Press and hold the HOME button then press any key

Press and hold the SELECT button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
7F,7F,00,80,80,0F,10,00
081F,E401
7F,7F,00,80,80,0F,10,00
7F,7F,00,80,80,0F,00,00

Press and hold the L1 button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
7F,7F,00,80,80,0F,01,00
081F,E401
7F,7F,00,80,80,0F,01,00
7F,7F,00,80,80,0F,00,00

Press and hold the DOWN button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
7F,FF,00,80,80,0F,00,00
081F,E401
7F,FF,00,80,80,0F,00,00
7F,7F,00,80,80,0F,00,00

Press and hold the RIGHT button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
FF,7F,00,80,80,0F,00,00
081F,E401
FF,7F,00,80,80,0F,00,00
7F,7F,00,80,80,0F,00,00

Press and hold the UP button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
7F,00,00,80,80,0F,00,00
081F,E401
7F,00,00,80,80,0F,00,00
7F,7F,00,80,80,0F,00,00

Press and hold the LEFT button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
00,7F,00,80,80,0F,00,00
081F,E401
00,7F,00,80,80,0F,00,00
7F,7F,00,80,80,0F,00,00

Press and hold the R2 button then press any key

Press and hold the X button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
7F,7F,00,80,80,1F,00,00
081F,E401
7F,7F,00,80,80,1F,00,00
7F,7F,00,80,80,0F,00,00

Press and hold the A button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
7F,7F,00,80,80,2F,00,00
081F,E401
7F,7F,00,80,80,2F,00,00
7F,7F,00,80,80,0F,00,00

Press and hold the Y button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
7F,7F,00,80,80,8F,00,00
081F,E401
7F,7F,00,80,80,8F,00,00
7F,7F,00,80,80,0F,00,00

Press and hold the B button then press any key
081F,E401
7F,7F,00,80,80,0F,00,00
7F,7F,00,80,80,4F,00,00
081F,E401
7F,7F,00,80,80,4F,00,00
7F,7F,00,80,80,0F,00,00

Press and hold the L2 button then press any key

Press and hold the TOUCH button then press any key
{
    .vid=0x81F,.pid=0xE401,
   .b_R1={6,1},
   .b_START={6,5},
   .b_HOME={255,0},
   .b_SELECT={6,4},
   .b_L1={6,0},
   .b_DOWN={1,192},
   .b_RIGHT={0,192},
   .b_UP={1,64},
   .b_LEFT={0,64},
   .b_R2={255,0},
   .b_X={5,4},
   .b_A={5,5},
   .b_Y={5,7},
   .b_B={5,6},
   .b_L2={255,0},
   .b_TOUCH={255,0}
},
gamepad configure &H81F,&HE401,6,1,6,5,255,0,6,4,6,0,1,192,0,192,1,64,0,64,255,0,5,4,5,5,5,7,5,6,255,0,255,0
 
ManiB
Regular Member

Joined: 12/10/2019
Location: Germany
Posts: 83
Posted: 09:59pm 25 Feb 2025
Copy link to clipboard 
Print this post

Hello matherp,

can I also help you test this with my Olimex RP2040-PICO-PC board?

I was able to successfully install and configure the version PicoMiteHDMIUSBV6.00.02b11.uf2.

Here are the necessary installation steps as a reminder:
1. flash the PicoMiteHDMIUSB on the Raspberry PI Pico 2
2. connect the USB keyboard to the Pico 2 (if necessary with a USB-C to USB-A adapter)
3. type the following command blindly: OPTION RESET OLIMEXUSB
4. reset the Olimex board

I have now tried to install your new version PicoMiteRP2350VGAUSBV6.00.02b12.uf2. But apparently my USB keyboard doesn't work anymore to type the command. I guess because now a USB gamepad is supported and not a USB keyboard, right?
Edited 2025-02-26 08:04 by ManiB
 
ManiB
Regular Member

Joined: 12/10/2019
Location: Germany
Posts: 83
Posted: 10:13pm 25 Feb 2025
Copy link to clipboard 
Print this post

Ohhh no, I had used the wrong UF2 file ;(

After I installed the PicoMiteHDMIUSBV6.00.02b12.uf2, it worked immediately, without entering OPTION RESET OLIMEXUSB

Now I can test my gamepads....
 
ManiB
Regular Member

Joined: 12/10/2019
Location: Germany
Posts: 83
Posted: 10:21pm 25 Feb 2025
Copy link to clipboard 
Print this post

This is what I get when disconnecting USB keyboard and connecting USB keypad:

> option list
PicoMiteHDMI MMBasic USB RP2350A Edition V6.00.02b12
OPTION SERIAL CONSOLE COM1,GP0,GP1
OPTION FLASH SIZE 4194304
OPTION COLOURCODE ON
OPTION KEYBOARD US
OPTION CPUSPEED (KHz) 315000
OPTION HDMI PINS  1, 3, 7, 5
OPTION SDCARD GP22, GP6, GP7, GP4
OPTION AUDIO GP26,GP27', ON PWM CHANNEL 5
OPTION MODBUFF ENABLE  192
OPTION PLATFORM OLIMEX USB
> USB Keyboard Disconnected
> Generic Gamepad Connected on channel 3
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4200
Posted: 12:45pm 26 Feb 2025
Copy link to clipboard 
Print this post

My apologies Peter. I'm juggling sickness and more than the usual level of work related nonsense. I'll see if I can do something this weekend.

Tom
Edited 2025-02-26 22:45 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Sasquatch

Guru

Joined: 08/05/2020
Location: United States
Posts: 375
Posted: 04:16pm 26 Feb 2025
Copy link to clipboard 
Print this post

I have a "Logitech F310 dual action" gamepad that I purchased at a thrift store (second hand store, charity shop?).  It has a switch on the back to switch "modes"

With the switch in the 'D' position your program reports the following:

   .vid=0x46D,.pid=0xC216,
   .b_R1={255,0},
   .b_START={255,0},
   .b_HOME={255,0},
   .b_SELECT={255,0},
   .b_L1={255,0},
   .b_DOWN={255,0},
   .b_RIGHT={255,0},
   .b_UP={255,0},
   .b_LEFT={255,0},
   .b_R2={255,0},
   .b_X={255,0},
   .b_A={255,0},
   .b_Y={255,0},
   .b_B={255,0},
   .b_L2={255,0},
   .b_TOUCH={255,0}
},
gamepad configure &H46D,&HC216,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0

With the switch in the 'X' position it reports the following:

    .vid=0x0,.pid=0x0,
   .b_R1={255,0},
   .b_START={255,0},
   .b_HOME={255,0},
   .b_SELECT={255,0},
   .b_L1={255,0},
   .b_DOWN={255,0},
   .b_RIGHT={255,0},
   .b_UP={255,0},
   .b_LEFT={255,0},
   .b_R2={255,0},
   .b_X={255,0},
   .b_A={255,0},
   .b_Y={255,0},
   .b_B={255,0},
   .b_L2={255,0},
   .b_TOUCH={255,0}
},
gamepad configure &H0,&H0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0

With the switch in the 'X' position, hardwaretester.com reports it as "xinput" which I believe is XBox compatible.

I assume that the above info indicates that this specific gamepad is not compatible with the PicoMite firmware in either mode?
-Carl
 
ManiB
Regular Member

Joined: 12/10/2019
Location: Germany
Posts: 83
Posted: 01:48pm 27 Feb 2025
Copy link to clipboard 
Print this post

I have tried to connect the "The Gamepad". But there was no response when I plugged it into the USB socket.

What could be the reason for this?
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9800
Posted: 02:05pm 27 Feb 2025
Copy link to clipboard 
Print this post

It means that the VID/PID isn't recognised. Try the process as defined in my first post
 
ManiB
Regular Member

Joined: 12/10/2019
Location: Germany
Posts: 83
Posted: 08:10pm 27 Feb 2025
Copy link to clipboard 
Print this post

  matherp said  It means that the VID/PID isn't recognised. Try the process as defined in my first post


OK, these are the results of my THEGAMEPAD:

> run
Make sure the gamepad is unplugged
press a key when ready
Plug in the gampad and make sure no buttons are pressed
press a key when ready
Generic Gamepad Connected on channel 3
We are now going to step through the 16 possible buttons on the gamepad
If your gamepad does not have the button requested just press any key to continue

Press and hold the R1 button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
7F,7F,7F,7F,7F,0F,02,40
1C59,0026
7F,7F,7F,7F,7F,0F,02,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the START button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
7F,7F,7F,7F,7F,0F,08,40
1C59,0026
7F,7F,7F,7F,7F,0F,08,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the HOME button then press any key

Press and hold the SELECT button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
7F,7F,7F,7F,7F,0F,04,40
1C59,0026
7F,7F,7F,7F,7F,0F,04,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the L1 button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
7F,7F,7F,7F,7F,0F,01,40
1C59,0026
7F,7F,7F,7F,7F,0F,01,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the DOWN button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
7F,FF,FF,FF,FF,0F,00,40
1C59,0026
7F,FF,FF,FF,FF,0F,00,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the RIGHT button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
FF,7F,7F,7F,7F,0F,00,40
1C59,0026
FF,7F,7F,7F,7F,0F,00,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the UP button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
7F,00,00,00,00,0F,00,40
1C59,0026
7F,00,00,00,00,0F,00,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the LEFT button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
00,7F,7F,7F,7F,0F,00,40
1C59,0026
00,7F,7F,7F,7F,0F,00,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the R2 button then press any key

Press and hold the X button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
7F,7F,7F,7F,7F,8F,00,40
1C59,0026
7F,7F,7F,7F,7F,8F,00,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the A button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
7F,7F,7F,7F,7F,4F,00,40
1C59,0026
7F,7F,7F,7F,7F,4F,00,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the Y button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
7F,7F,7F,7F,7F,1F,00,40
1C59,0026
7F,7F,7F,7F,7F,1F,00,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the B button then press any key
1C59,0026
7F,7F,7F,7F,7F,0F,00,40
7F,7F,7F,7F,7F,2F,00,40
1C59,0026
7F,7F,7F,7F,7F,2F,00,40
7F,7F,7F,7F,7F,0F,00,40

Press and hold the L2 button then press any key

Press and hold the TOUCH button then press any key
{
    .vid=0x1C59,.pid=0x26,
   .b_R1={255,0},
   .b_START={255,0},
   .b_HOME={255,0},
   .b_SELECT={255,0},
   .b_L1={255,0},
   .b_DOWN={255,0},
   .b_RIGHT={255,0},
   .b_UP={255,0},
   .b_LEFT={255,0},
   .b_R2={255,0},
   .b_X={255,0},
   .b_A={255,0},
   .b_Y={255,0},
   .b_B={255,0},
   .b_L2={255,0},
   .b_TOUCH={255,0}
},
gamepad configure &H1C59,&H26,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0
>
 
al18
Senior Member

Joined: 06/07/2019
Location: United States
Posts: 218
Posted: 03:15am 28 Feb 2025
Copy link to clipboard 
Print this post

I like the Logitech F310 because with the switch set to D, it works on virtually all Macs made in the past 25 years.

When the switch is set to X and connected to a PC, it works as an X-Box controller.
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9800
Posted: 08:17am 28 Feb 2025
Copy link to clipboard 
Print this post

  Quote  OK, these are the results of my THEGAMEPAD:


Looks like you are releasing the button before pressing the key on the keyboard - did you use a USB keyboard connected to the Pico? If so please repeat using a computer console session and only have the gamepad plugged into the Pico - nothing else. The monitor log shows the device is responding but the output is no use.
 
ManiB
Regular Member

Joined: 12/10/2019
Location: Germany
Posts: 83
Posted: 10:21am 28 Feb 2025
Copy link to clipboard 
Print this post

  matherp said  
  Quote  OK, these are the results of my THEGAMEPAD:


Looks like you are releasing the button before pressing the key on the keyboard - did you use a USB keyboard connected to the Pico? If so please repeat using a computer console session and only have the gamepad plugged into the Pico - nothing else. The monitor log shows the device is responding but the output is no use.


Ohh sorry, I used it wrong and pressed a key on the keyboard after releasing the buttons. Anyone who can read has a clear advantage ;)

OK, these are the correct results of my THEGAMEPAD:

{
    .vid=0x1C59,.pid=0x26,
   .b_R1={6,1},
   .b_START={6,3},
   .b_HOME={255,0},
   .b_SELECT={6,2},
   .b_L1={6,0},
   .b_DOWN={1,192},
   .b_DOWN={2,192},
   .b_DOWN={3,192},
   .b_DOWN={4,192},
   .b_RIGHT={0,192},
   .b_UP={1,64},
   .b_UP={2,64},
   .b_UP={3,64},
   .b_UP={4,64},
   .b_LEFT={0,64},
   .b_R2={255,0},
   .b_X={5,7},
   .b_A={5,6},
   .b_Y={5,4},
   .b_B={5,5},
   .b_L2={255,0},
   .b_TOUCH={255,0}
},
gamepad configure &H1C59,&H26,6,1,6,3,255,0,6,2,6,0,1,192,2,192,3,192,4,192,0,192,1,64,2,64,3,64,4,64,0,64,255,0,5,7,5,6,5,4,5,5,255,0,255,0
>

Edited 2025-02-28 20:25 by ManiB
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9800
Posted: 10:30am 28 Feb 2025
Copy link to clipboard 
Print this post

Still something odd - lots of UPs and Downs, I think I can see what is happening - very strange response with 4 bytes changing for both UP and DOWN. What firmware version are you using and I'll post a test version.
Edited 2025-02-28 20:36 by matherp
 
ManiB
Regular Member

Joined: 12/10/2019
Location: Germany
Posts: 83
Posted: 10:39am 28 Feb 2025
Copy link to clipboard 
Print this post

  matherp said  Still something odd - lots of UPs and Downs


I've noticed that, but even if I repeat it, it doesn't change.

I have connected the gemapad to the Pico's USB port. Putty is connected to the serial port on the Olimex board. I keep pressing via Putty while holding down the respective gamepad button.

I'm using PicoMiteHDMIUSBV6.00.02b12.uf2
Edited 2025-02-28 20:48 by ManiB
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9800
Posted: 10:47am 28 Feb 2025
Copy link to clipboard 
Print this post

Try this - should be fully supported - used DEVICE(GAMEPAD 3,B) to read the output


PicoMite.zip
 
ManiB
Regular Member

Joined: 12/10/2019
Location: Germany
Posts: 83
Posted: 11:02am 28 Feb 2025
Copy link to clipboard 
Print this post

  matherp said  Try this - should be fully supported - used DEVICE(GAMEPAD 3,B) to read the output


PicoMite.zip


Yes, now THEGAMEPAD is recognized ;)

> Generic Gamepad Connected on channel 3
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 9800
Posted: 11:15am 28 Feb 2025
Copy link to clipboard 
Print this post

One variant down - how many to go?
 
ManiB
Regular Member

Joined: 12/10/2019
Location: Germany
Posts: 83
Posted: 11:59am 28 Feb 2025
Copy link to clipboard 
Print this post

My testprogram works using raw$ = DEVICE(gamepad 3, raw).

How can i use btn% = DEVICE(gamepad 3, B) ?

-----
Rem THEGAMEPAD on RP2040-PICO-PC Olimex board
Rem PicoMiteHDMI MMBasic USB RP2350A Edition V6.00.02b14
Rem option reset olimexusb

raw$ = ""
old$ = ""
direction$ = ""

Do
Rem GAMEPAD read
Rem btn% = DEVICE(gamepad 3, B)
raw$ = DEVICE(gamepad 3, raw)
If old$ <> raw$ Then
   old$ = raw$

   xAxis% = Asc(Mid$(raw$, 1, 1))
   yAxis% = Asc(Mid$(raw$, 2, 1))

   direction$ = ""
   If xAxis% = &HFF Then direction$ = direction$ + "RIGHT"
   If xAxis% = &H00 Then direction$ = direction$ + "LEFT"
   If yAxis% = &HFF Then direction$ = direction$ + "DOWN"
   If yAxis% = &H00 Then direction$ = direction$ + "UP"
   Print xAxis%, yAxis%, direction$
   Print "-----"
EndIf
Loop While Inkey$=""

Print "ready..."
 
ManiB
Regular Member

Joined: 12/10/2019
Location: Germany
Posts: 83
Posted: 12:04pm 28 Feb 2025
Copy link to clipboard 
Print this post

Ahh i found this...

 Const btn% = Device(Gamepad id%, B)
 Const b$ = str.rpad$(buttons_as_string$(btn%), 40)



Function buttons_as_string$(btn%)
 Local s$
 If btn% And &h01 Then Cat s$, "R, "
 If btn% And &h02 Then Cat s$, "Start, "
 If btn% And &h04 Then Cat s$, "Home, "
 If btn% And &h08 Then Cat s$, "Select, "
 If btn% And &h10 Then Cat s$, "L, "
 If btn% And &h20 Then Cat s$, "Down, "
 If btn% And &h40 Then Cat s$, "Right, "
 If btn% And &h80 Then Cat s$, "Up, "
 If btn% And &h100 Then Cat s$, "Left, "
 If btn% And &h200 Then Cat s$, "ZR, "
 If btn% And &h400 Then Cat s$, "X, "
 If btn% And &h800 Then Cat s$, "A, "
 If btn% And &h1000 Then Cat s$, "Y, "
 If btn% And &h2000 Then Cat s$, "B, "
 If btn% And &h4000 Then Cat s$, "ZL, "
 If Len(s$) Then s$ = Left$(s$, Len(s$) - 2)
 buttons_as_string$ = s$
End Function
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7339
Posted: 12:04pm 28 Feb 2025
Copy link to clipboard 
Print this post

Should things like PS3 controllers work? I also have a Saitek that may or may not do anything - that may be a PC one.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
     Page 1 of 3    
Print this page
© JAQ Software 2025