Go to Post Team 1114 does not design or build ROBOTS. They build AWESOME. - DonRotolo [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 07-02-2009, 13:04
furiousgeorge's Avatar
furiousgeorge furiousgeorge is offline
Registered User
FRC #3055
 
Join Date: Jan 2009
Location: Austin
Posts: 74
furiousgeorge will become famous soon enoughfuriousgeorge will become famous soon enough
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?
  #2   Spotlight this post!  
Unread 07-02-2009, 13:52
bwobo bwobo is offline
Team 1458
FRC #1458
Team Role: Engineer
 
Join Date: Jan 2008
Rookie Year: 2006
Location: California
Posts: 15
bwobo is just really nicebwobo is just really nicebwobo is just really nicebwobo is just really nice
Send a message via AIM to bwobo
Re: joystick button

If you look in the SimpleRobot example class it shows a joystick defined:
Code:
Joystick *joystickname;
//then later:
joystickname = new Joystick (1) //where "1" is, is the USB port on the Driver Station in which the joystick is plugged into.
//then in your teleop code:
if (joystickname -> GetRawButton(button #)){
//put code here for which motor to run
}
Of course this is with WindRiver and C++, LabView you will need someone else's help on

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.
__________________

Last edited by bwobo : 07-02-2009 at 13:56.
  #3   Spotlight this post!  
Unread 07-02-2009, 14:45
furiousgeorge's Avatar
furiousgeorge furiousgeorge is offline
Registered User
FRC #3055
 
Join Date: Jan 2009
Location: Austin
Posts: 74
furiousgeorge will become famous soon enoughfuriousgeorge will become famous soon enough
Re: joystick button

yeah, i'm using labview, thanks though
  #4   Spotlight this post!  
Unread 07-02-2009, 15:37
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
  #5   Spotlight this post!  
Unread 07-02-2009, 15:42
furiousgeorge's Avatar
furiousgeorge furiousgeorge is offline
Registered User
FRC #3055
 
Join Date: Jan 2009
Location: Austin
Posts: 74
furiousgeorge will become famous soon enoughfuriousgeorge will become famous soon enough
Re: joystick button

i'm sorry but i'm a rookie, and none of what you just said really made any sense
  #6   Spotlight this post!  
Unread 07-02-2009, 15:57
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,748
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
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
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming a joystick button... programmr Programming 2 05-01-2009 16:13
Using a button on a joystick to track? DemonYawgmoth Programming 5 12-02-2006 11:17
Joystick Hat button ten3brousone Programming 8 20-02-2005 13:31
Joystick Button programming Bharat Nain Programming 5 18-02-2005 11:48
Joystick Button Deference cibressus53 Electrical 3 01-11-2004 09:38


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

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