|
Page 1 of 1
|
[ 5 posts ] |
|
Logitech Gamepad Controls
Author |
Message |
adbyers58
Rookie
Joined: Wed May 14, 2014 8:21 am Posts: 3
|
 Logitech Gamepad Controls
So recently I have tried putting in controls associated with the Logitech gamepad for RVW, but they keep on giving me errors! please help! Here's my code:
#pragma debuggerWindows("joystickSimple"); #include "JoystickDriver.c"
task main() { //Loop Forever while(1 == 1) { //Get the Latest joystick values getJoystickSettings(joystick); //Set the driving motors equal to the Y-axis values of the joysticks motor[leftMotor] = joystick.joy1_y1; motor[rightMotor] = joystick.joy1_y2; if(joystick.joy2_Buttons[Btn6U] == 1) { motor[armMotor] = 40; } else { motor[armMotor] = 0; } if(joystick.joy2_Buttons[Btn6D] == 1) { motor[armMotor] = -40; } else { motor[armMotor] = 0; } } }
it says I need a "pointer value"
|
Wed May 14, 2014 8:25 am |
|
 |
BurningLights
Professor
Joined: Sat Aug 31, 2013 9:15 am Posts: 256
|
 Re: Logitech Gamepad Controls
Unfortunately, in Virtual Worlds you can only use one joystick. So, joystick.joy2_Buttons is undefined. Also, if you want to figure out if a button is pushed, you can simply use:
_________________FTC Team 6100 Chariots of Fire - Programmer (2012-2013) FTC Team 7468 Blue Chariots of Fire - Programmer (2013-2014) FTC Team 7468 Blue Chariots of Fire - Mentor (2014-2015) Check out our team website at http://bluechariotsoffire.com/.
|
Wed May 14, 2014 9:02 am |
|
 |
adbyers58
Rookie
Joined: Wed May 14, 2014 8:21 am Posts: 3
|
 Re: Logitech Gamepad Controls
thank you for that, but what are the button numbers in relation to the controller?
|
Wed May 14, 2014 7:40 pm |
|
 |
adbyers58
Rookie
Joined: Wed May 14, 2014 8:21 am Posts: 3
|
 Re: Logitech Gamepad Controls
I have taken your suggested changes and now it is still giving me errors. Here's my code:
#pragma debuggerWindows("joystickSimple"); #include "JoystickDriver.c"
task main() { //Loop Forever while(1 == 1) { //Get the Latest joystick values getJoystickSettings(joystick); //Set the driving motors equal to the Y-axis values of the joysticks motor[leftMotor] = joystick.joy1_y1; motor[rightMotor] = joystick.joy1_y2; if(joy1Btn[7] == 1) { motor[armMotor] = 70; } else { motor[armMotor] = 0; } if(joy1Btn[5] == 1) { motor[armMotor] = -70; } else { motor[armMotor] = 0; } } }
it's telling me I need a "pointer value" again.
|
Wed May 14, 2014 7:46 pm |
|
 |
rcahoon
Site Admin
Joined: Tue Oct 09, 2012 10:34 am Posts: 192
|
 Re: Logitech Gamepad Controls
Hi adbyers58, joy1Btn is a function, not an array, so you need to use parentheses () instead of square brackets [] The corrected code would look like: Cheers, --Ryan
_________________ Ryan Cahoon CMU Robotics Academy RVW Software Developer
Robot Potato Head; Virtual NXT
|
Thu May 15, 2014 10:54 am |
|
|
|
Page 1 of 1
|
[ 5 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
|
|