Go to Post I hate mini-bots. - Gdeaver [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 27-01-2013, 13:26
VikingRobotics's Avatar
VikingRobotics VikingRobotics is offline
Registered User
FRC #1989
 
Join Date: Jan 2013
Location: Vernon, NJ
Posts: 2
VikingRobotics is an unknown quantity at this point
Problem with Shooter Code for FRC

Salutations fellow programmers!
I'm the programmer for team 1989. This is my first year programming so I thought I'd reach out for a little help. Our team is going to have our shooter positioned at a fixed angle (36.8 degrees) and then we are going to vary the speed depending on our distance from the goals. I programmed 3 buttons on the attack 3 joystick for 3 different speeds but the motors for the shooter will only stay on when I am holding the button. I wanted to know if it is possible to program the buttons so that you push it once to turn the motors on and then push it again to turn them off. Nothing I've tried has worked so far. Here's the method I made for the shooter:

public void shooter()
{

final int button1 = 2;
final int button2 = 3;
final int button3 = 4;
double speed = 0;
if (leftstick.getRawButton(button1))//when button 2 is pressed motor moves at 30% of max speed
{
speed = 0.3;
}
if (leftstick.getRawButton(button2))//when button 3 is pressed motor moves at 60% of max speed
{
speed = 0.6;
}
if (leftstick.getRawButton(button3))//when button 4 is pressed motor moves at 90% of max speed
{
speed = 0.9;
}
Victor3.set(speed);
Victor4.set(speed);
}
Reply With Quote
 


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 11:45.

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