Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stick data decoding? #155

Open
WindowStations opened this issue Jul 13, 2024 · 0 comments
Open

Stick data decoding? #155

WindowStations opened this issue Jul 13, 2024 · 0 comments

Comments

@WindowStations
Copy link

I'm accessing JoyCons with Visual Basic 6 and I've run into a mess trying to decode the thumbstick data. I think I got it manually by observing the numbers that change faster than others, to figure out their place value. I was not able to convert the sample here in the Bluetooth section.

I'm using the following process to try and decode the stick data.

        Dim x As String
        Dim y As String
       'left joycon
         x = VBA.Mid(bv, 16, 1) & VBA.Mid(bv, 13, 1) & VBA.Mid(bv, 14, 1) 
         y = VBA.Mid(bv, 17, 1) & VBA.Mid(bv, 18, 1) & VBA.Mid(bv, 15, 1) 

        'right joycon
         x = VBA.Mid(bv, 22, 1) & VBA.Mid(bv, 19, 1) & VBA.Mid(bv, 21, 1)
         y = VBA.Mid(bv, 23, 1) & VBA.Mid(bv, 24, 1) & VBA.Mid(bv, 20, 1)

Original code:

uint8_t *data = packet + (left ? 4 : 8);
uint16_t stick_horizontal = data[0] | (data[1] << 8);
uint16_t stick_vertical = data[2] | (data[3] << 8);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant