View Single Post
  #8   Spotlight this post!  
Unread 15-02-2009, 01:13
vhcook's Avatar
vhcook vhcook is online now
Reader of Things
AKA: Victoria
FRC #1939 (Kuh-nig-its)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Kansas City, MO
Posts: 546
vhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond reputevhcook has a reputation beyond repute
Re: limit switch help

Quote:
Originally Posted by s0crates View Post
I think you may be missing the (hidden) easiest route: the jags have built in ports for limit switches.
Regrettably, FIRST has made that illegal this year to reduce the number of new things being introduced. See this Q&A response.

The attached is a screenshot of how I handled limit switches. This is a subvi that comes off of teleop.vi in the advanced framework. I've built the motor device reference and the limit switches into a typedef and passed them into the subvi. If you're in the basic framework you could open the devices in the same part of the code that the drive motors are opened, pass the references into the teleop execute case, and then drop something like this code in.

Basically, if the input signal is sending the turret left, it checks the left limit switch and stops if the switch is active, otherwise it does what it was told. If it's sending the turret right, it checks the right limit switch and stops if the switch is active and does what it's told otherwise. It checks each time teleop runs within the main loop. The extra indicators are not required - they just make it easy to see what's going on with the limit switches from the front panel of the vi.
Attached Thumbnails
Click image for larger version

Name:	turret control.jpg
Views:	79
Size:	57.5 KB
ID:	7452  
__________________


Reply With Quote