View unanswered posts | View active topics It is currently Sat Jun 23, 2018 4:05 pm

Reply to topic  [ 2 posts ] 
Logitech d-pad code? 
Author Message

Joined: Sun Oct 10, 2010 1:49 am
Posts: 2
Post Logitech d-pad code?
What would the code be for the d-pad on the left side of the logitech controller?


Sun Oct 10, 2010 1:51 am
Site Admin
Site Admin

Joined: Mon Jun 08, 2009 4:50 pm
Posts: 70
Post Re: Logitech d-pad code?

In the ROBOTC help file under "Joystick Control > Using Joysticks" there is a page that lists all of the buttons and functions related to them.

For the "D-Pad" it is

This returns a value from -1 to 7 where -1 means no buttons are pressed, 0 is the top button, and 7 is the upper left button (it starts at the top and counts clockwise from there).
So it looks something like this:
(I'm using the code format just to get the spacing even)
  7   1
6  -1   2
  5   3

Here is the sample from the help file:
while(true)                      // Infinite loop:
  if(joystick.joy1_TopHat == 0)      // If the topmost button on joy1's D-Pad ('TopHat') is pressed:
    motor[motorA] = 50;                  // MotorA is run at a power level of 50.

I hope that helps!

Bence Feher

Undergraduate Intern - NREC, Robotics Academy
ROBOTC - Testing/Documentation/Developer

Computer Science, Japanese, East Asian Studies
University of Pittsburgh, Konan University 甲南大学

Fri Oct 15, 2010 4:02 pm
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.