![]() |
joystick button
hey, i'm trying to program a motor to run off of a button on the joystick (preferably the trigger button) but i'm not sure exactly how to do that can someone help me?
|
Re: joystick button
If you look in the SimpleRobot example class it shows a joystick defined:
Code:
Joystick *joystickname;EDIT: Saw your other thread. This code will make it so when you hold a button down the specified motor runs. If you want it so one button sends it forward, and another backward, its the same thing, just another if statement. (in one if statement, set the motor to a value of 1 (makes it go forward full speed), then in the other if statement, set the motor to a value of -1 (full speed in reverse) If you want it so you only have to press the button once for it to start, then again for it to stop, you need to create a boolean for the motor running, and have the button set it true or false. |
Re: joystick button
yeah, i'm using labview, thanks though
|
Re: joystick button
Break the problem down. First see if you can figure out how to read the joystick button.
Next use the Motor WPI VIs to set the motor speed to 0 or some nonzero value to control the speed. Now put the two together so that the button Boolean selects one of two speeds. If you want the button to be sticky, you need storage such as a feedback node, a shift register, or a variable. If this doesn't help, ask for specifics on the part above you can't figure out. Greg McKaskle |
Re: joystick button
i'm sorry but i'm a rookie, and none of what you just said really made any sense
|
Re: joystick button
Programming involves breaking big tasks down into small tasks that you know how to do. First figure out how to read a joystick button. You might want to look at examples, or show the context help window and look at the palette of icons for reading the joystick.
Then move on to the other steps. Greg McKaskle |
| All times are GMT -5. The time now is 02:20. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi