View Single Post
  #2   Spotlight this post!  
Unread 17-12-2007, 18:56
AdamHeard's Avatar
AdamHeard AdamHeard is offline
Lead Mentor
FRC #0973 (Greybots)
Team Role: Mentor
 
Join Date: Oct 2004
Rookie Year: 2004
Location: Atascadero
Posts: 5,503
AdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond reputeAdamHeard has a reputation beyond repute
Send a message via AIM to AdamHeard
Re: Using a limit switch to limit motion

Quote:
Originally Posted by ManicMechanic View Post
(This question is from a team member who's skittish about signing up for CD )

We use R/C tank commands to move an arm, but it damages the gears if we go past a certain point. Our design uses a limit switch to detect when we get near the breaking point. What we want to do is program the R/C controls to allow it to go in one direction (away from the breaking point), but not in the other direction (across the breaking point) when it hits the limit. That way, if someone keeps pushing the joysticks forward, it would stay in one place, then if they reverse the joy sticks, it moves back into the "safer" zone.

So far, the only thing we can get it to do when the limit switch detects the breaking point is to use motor commands to reverse the direction for a bit, then revert back to R/C. If someone keeps the joysticks pressed up, it goes up to the limit, then down, then wobbles up and down again, which we don't want. Is there any way to just disable the joysticks so it stops when it reaches the limit but comes back down when the joysticks go in reverse without wobbling?

We are using EasyC for Vex.
I am not familar with easy C, but put in an if statement like this (psuedo code);

if (Limit being hit AND motor being driven towards being hit [aka wrong way])
{
motor = 127;
}

This will cause the arm to stop when it hits the limit switch, but you can still drive it in the other direction (I'll admit the first time I tried this I just had it stop when the switch was hit.... So, the arm was stuck).