Go to Post A mentor doesn't have to win the WFA at a competition to know that they've inspired the team. - Laura 1547 [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
  #3   Spotlight this post!  
Unread 22-01-2014, 23:31
shindigo shindigo is offline
Registered User
AKA: Mike Parker
FRC #0102
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2009
Location: Somerville, NJ
Posts: 33
shindigo is an unknown quantity at this point
Re: NEW PROGRAMMER - MOTOR PROGRAMMING

Here is an outline of what you need to do to accomplish the goals you have laid out in your post:
1. Create a subsystem to control access to the motor. This class will contain a member variable that is the speedcontroller for the motor, see Jaguar, Victor, or Talon.
2. Within this subsystem you will create a Java function that will set the motor to a particular speed. Pass the speed as a parameter to the function.
3. Create a Command that will turn the motor on. Inside the initialize or the execute this will call the function from step 2. In the end and interrupt functions you will want to set the motor speed to zero again by calling the function from step 2.
4 in the operator interface OI.java you will need to create the Joystick object and the button objects. Use the button's whenPressed function to assign the command from step 3 to the button.
5. At this point I'm a little confused about your requirements: you say you want the motor to run for 5 secs, but you also say you want to stop the motor with another button press. Which is it? If you want the Command to timeout after 5 secs use the set Timeout function of the command to set the timeout and check the isTimeout function in the isFinished function of the command.
6. If you want to stop the motor with a second button, create the button in OI and have it call a Command that sets the motor speed to zero.

Hope that gets you going...
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:08.

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