View Single Post
  #2   Spotlight this post!  
Unread 13-01-2012, 20:52
ssirovica's Avatar
ssirovica ssirovica is offline
Programming Captain
AKA: Sasha Sirovica
FRC #1458 (Red Ties)
Team Role: Programmer
 
Join Date: Sep 2011
Rookie Year: 2010
Location: Alamo
Posts: 26
ssirovica is an unknown quantity at this point
Re: Automatic limit switch

To stop a motor at a certain speed, that is a job for encoders. Encoders track the number of rotations of a shaft which you can use to compute the speed.

You could use a limit switch to stop a motor when the motor reaches a certain position, assuming that the motor turns some armature which physically turns the switch off.

The code for this in java would look like this:

DigitalInput limitSwitch = new DigitalInput(3); The constructor argument is the port its plugged into on the io board.

Then to get a Boolean value of weather it is closed or not use limitSwitch.get();

Good Luck!
__________________
Computers run on smoke. When you let the smoke out the computer stops working.