Go to Post I'm throwing the Unnecessary Sarcasm Flag here. - Joe Johnson [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
  #1   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,508
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).
  #2   Spotlight this post!  
Unread 17-12-2007, 20:00
DonRotolo's Avatar
DonRotolo DonRotolo is offline
Back to humble
FRC #0832
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Atlanta GA
Posts: 7,011
DonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond reputeDonRotolo has a reputation beyond repute
Re: Using a limit switch to limit motion

If you are holding the joystick against the limit, then what code allows the motor to 'reverse' when it hist the switch? Don't let it do that, just make it so the motor won't see a PWM value on the "too far" side of 127.

Pseudo Pseudocode:

Code:
Do Tank Drive
While (Limit_Switch_Too_Far_Up=1)
  If Motor Input < 127, then Motor Input = 127
End While
Don
__________________

I am N2IRZ - What's your callsign?
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using a limit switch thunderbolt Programming 1 02-04-2007 19:36
limit switch wedellm Electrical 4 16-02-2007 13:01
Limit Switch Basics JWSnedden Programming 6 30-11-2006 19:48
Limit switch in easy c? chadbarbe Programming 6 02-02-2006 09:51


All times are GMT -5. The time now is 03:16.

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