Go to Post FIRST is the only high-school sport where everyone can become a pro - David Brinza [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 04-19-2015, 11:53 AM
Cinnamon Toast's Avatar
Cinnamon Toast Cinnamon Toast is offline
Registered User
FRC #3641 (The Flying Toasters)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Michigan
Posts: 32
Cinnamon Toast is an unknown quantity at this point
Button Layout on Dual Shock 4

Hello Everyone,

For the longest time, we have been using the Logitech dual shock controller as our main driving controller.Recently we moved to a PlayStation DualShock 4 controller for ergonomic reasons. So far it's been working great. Via the attached micro USB cable connection (cause sadly we can't use blutooth) control is normal, as the mapping pretty much stayed the same. One thing that we've never used though (and I would like to start using) are the D-pad buttons on the controller. Now, in the driver station they don't recognize as buttons, but rather the POV hat I believe. That being said, I'm not sure that I can reference them they same way I do buttons in code.

gamepad.GetRawButton(some number here)

That's how I would normally reference all the other buttons, but how do I reference the D-pad buttons in C++? I would appreciate any help possible!

-Cinnamon Toast
Reply With Quote
  #2   Spotlight this post!  
Unread 04-19-2015, 12:54 PM
ghead ghead is offline
Registered User
FRC #3103
 
Join Date: Aug 2013
Location: US
Posts: 13
ghead is an unknown quantity at this point
Re: Button Layout on Dual Shock 4

Use the GetPOV() method of Joystck to get the current DPad reading. We've used something similar to this in the past::

Code:
switch (m_driveStick.GetPOV())
    {
        case 0:
            // Do Something - the 'up' button
            break;

        case 90:
            // Do Something - the 'right' button
            break;

        case 180:
            // Do Something - down
            break;

        case 270:
            // Do Something - left
            break;

        default:
            break;
    }
Reply With Quote
  #3   Spotlight this post!  
Unread 04-19-2015, 01:01 PM
Cinnamon Toast's Avatar
Cinnamon Toast Cinnamon Toast is offline
Registered User
FRC #3641 (The Flying Toasters)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Michigan
Posts: 32
Cinnamon Toast is an unknown quantity at this point
Re: Button Layout on Dual Shock 4

Just to be clear it looks as if the d-pad buttons are referenced via angles going clockwise? And if two are referenced such as to give an angle in between 90 degree steps, just account for that with a split angle?
Reply With Quote
  #4   Spotlight this post!  
Unread 05-15-2015, 12:52 PM
cobzar cobzar is offline
Registered User
no team
 
Join Date: May 2015
Location: Romania
Posts: 1
cobzar is an unknown quantity at this point
Re: Button Layout on Dual Shock 4

What are you guys using as far as gaming controllers for your tablets? I have a PS3 and Xbox One controller at home. Just wondering if either can be easily used to play on my dragon touch m8 tablet.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:46 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi