Go to Post So kudos for asking advice... you've got plenty of good advice so far in this column... but honestly, if Orville and Wilbur Wright had taken good advice they would have packed up and gone back to their bicycle shop. - dtengineering [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 28-02-2012, 22:27
Team1605 Team1605 is offline
Registered User
FRC #1605
 
Join Date: Feb 2012
Location: toronto
Posts: 30
Team1605 is an unknown quantity at this point
Help with java coding

How can i program a motor to spin 180 degrees forward when i press a button and then spin 180 degrees backwards when i press a different button?
Reply With Quote
  #2   Spotlight this post!  
Unread 28-02-2012, 22:40
ProjectZero ProjectZero is offline
Registered User
FRC #4276 (Vikings Robotics)
Team Role: Mentor
 
Join Date: May 2011
Rookie Year: 2008
Location: Huntington Beach, CA
Posts: 10
ProjectZero is an unknown quantity at this point
Re: Help with java coding

Well, if you want to spin a certain number of degrees you'll need a sensor on your motor shaft.

You can attach a potentiometer to your motor shaft. A potentiometer is an analog sensor that measures how far you have rotated based on the change in its resistance. Sure "program potentiometer" on Chief Delphi and I'm sure there are threads devoted to it. If I recall, you can hook the potentiometer up to an analog channel and read the data it gives you (a certain change in voltage will correspond to a certain change in degrees). You would read your potentiometer, then tell the motor to run. You would continue to read your potentiometer and tell the motor to stop running when it had turned a certain amount.

If it's an arm of some sorts, you can use a limit switch. A limit switch is a very simple sensor that gives off a signal when a small lever is touched. One came in the kit of parts. You could tell your motor to stop running when the arm or whatever is attached to it rotated 180 degrees.

Of course, the simplest and crudest way would be to set your motor to a certain speed, measure how long it takes to turn 180 degrees, then tell your motor to turn for that amount of time and stop.

Hope this helps.
Reply With Quote
  #3   Spotlight this post!  
Unread 01-03-2012, 13:11
Team1605 Team1605 is offline
Registered User
FRC #1605
 
Join Date: Feb 2012
Location: toronto
Posts: 30
Team1605 is an unknown quantity at this point
Re: Help with java coding

it kinda helped but m confused how to do the coding

for it in operated controls. i am programing in java BTW
Reply With Quote
Reply


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 09:48.

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