Go to Post Robot? What robot?! - LightWaves1636 [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 20-04-2005, 10:33
stephenthe1 stephenthe1 is offline
Registered User
#1008
 
Join Date: Dec 2004
Location: Ohio
Posts: 113
stephenthe1 is on a distinguished road
limit switches

Hi,
We've been having a little trouble using limit switches. We get the value registered when the limit switch is pressed, but when it is released, the value doesn't change back. I figured the first thing to check would be the wiring. I haven't seen much on chiefdelphi after searching on limit switches, so if you could provide a wiring diagram, that would be helpful. Then secondly, maybe sample code for referencing the limit switch. ThankS!
-Stephen P.
  #2   Spotlight this post!  
Unread 20-04-2005, 12:41
Unsung FIRST Hero
Mike Betts Mike Betts is offline
Electrical Engineer
no team
Team Role: Engineer
 
Join Date: Dec 2001
Rookie Year: 1995
Location: Homosassa, FL
Posts: 1,442
Mike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond reputeMike Betts has a reputation beyond repute
Re: limit switches

As per page 9 of the "Full Size RC Reference Guide", switches are connected between SIG and GND on the digital input.
__________________
Mike Betts

Alumnus, Team 3518, Panthrobots, 2011
Alumnus, Team 177, Bobcat Robotics, 1995 - 2010
LRI, Connecticut Regional, 2007-2010
LRI, WPI Regional, 2009 - 2010
RI, South Florida Regional, 2012 - 2013

As easy as 355/113...
  #3   Spotlight this post!  
Unread 26-04-2005, 10:11
stephenthe1 stephenthe1 is offline
Registered User
#1008
 
Join Date: Dec 2004
Location: Ohio
Posts: 113
stephenthe1 is on a distinguished road
Re: limit switches

we're having a big problem with our limit switches. Basically, once it is pressed, the value of it changes it to 1, which is good, but once it is released, it doesn't change back to 0. hilf mir! danke schon
  #4   Spotlight this post!  
Unread 27-04-2005, 01:42
David Brinza's Avatar
David Brinza David Brinza is offline
Lead Mentor, Lead Robot Inspector
FRC #0980 (ThunderBots)
Team Role: Mentor
 
Join Date: Feb 2003
Rookie Year: 2003
Location: Glendale, CA
Posts: 1,378
David Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond reputeDavid Brinza has a reputation beyond repute
Re: limit switches

Quote:
Originally Posted by stephenthe1
we're having a big problem with our limit switches. Basically, once it is pressed, the value of it changes it to 1, which is good, but once it is released, it doesn't change back to 0. hilf mir! danke schon
Make sure you're using a "momentary contact" switch rather than a latching or locking switch. The momentary contact switch will only remain closed/open while the switch is depressed, whereas a latching/locking switch toggles between open and closed each time the switch is depressed.
__________________
"There's never enough time to do it right, but always time to do it over."
2003 AZ: Semifinals, Motorola Quality; SoCal: Q-finals, Xerox Creativity; IRI: Q-finals
2004 AZ: Semifinals, GM Industrial Design; SoCal: Winners, Leadership in Controls; Championship: Galileo #2 seed, Q-finals; IRI: Champions
2005 AZ: #1 Seed, Xerox Creativity; SoCal: Finalist, RadioShack Controls; SVR: Winners, Delphi "Driving Tomorrow's Technologies"; Championship: Archimedes Semifinals; IRI: Finalist
2007 LA: Finalist; San Diego: Q-finals; CalGames: Finalist || 2008 San Diego: Q-finals; LA: Winners; CalGames: Finalist || 2009 LA: Semifinals; Las Vegas: Q-finals; IRI: #1 Seed, Finalist
2010 AZ: Motorola Quality; LA: Finalist || 2011 SD: Q-finals; LA: Q-finals || 2013 LA: Xerox Creativity, WFFA, Dean's List Finalist || 2014 IE: Q-finals, LA: Finalist, Dean's List Finalist
2016 Ventura: Q-finals, WFFA, Engineering Inspiration
  #5   Spotlight this post!  
Unread 26-04-2005, 10:34
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,355
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: limit switches

Quote:
Originally Posted by stephenthe1
Hi,
We've been having a little trouble using limit switches. We get the value registered when the limit switch is pressed, but when it is released, the value doesn't change back. I figured the first thing to check would be the wiring. I haven't seen much on chiefdelphi after searching on limit switches, so if you could provide a wiring diagram, that would be helpful. Then secondly, maybe sample code for referencing the limit switch. ThankS!
-Stephen P.
A couple of questions, or answers to them, might help:
1) How are the switches connected? For example: Are they connected to the RC Digital input 1, 2, 3 etc.
2) How are you "registering them"? Do you have your own code, or are you using the interrupts associated with the digital inputs?
3) When it sticks, how do you unstick it? Manually or by reseting the controllers?

If you are using the digital inputs, my guess is that the switches are sticking, either by binding of the mechanism, or internally to the micro switch it's self. If you are using your own code to set a flag, the code may not be written to reset the flag once the switch state changes.

Good Luck, and let us know what you find.
  #6   Spotlight this post!  
Unread 26-04-2005, 15:53
Ryan M. Ryan M. is offline
Programming User
FRC #1317 (Digital Fusion)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Ohio
Posts: 1,508
Ryan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud ofRyan M. has much to be proud of
Re: limit switches

Quote:
Originally Posted by billbo911
If you are using the digital inputs, my guess is that the switches are sticking, either by binding of the mechanism, or internally to the micro switch it's self. If you are using your own code to set a flag, the code may not be written to reset the flag once the switch state changes.
I bet he's right. Try hooking a multimeter up to the switch and see how the resistance changes when you press and release the switch. If it's working properly, you should see a high (infinite, depending on the meter) resistance when released, followed by a fairly low resistance when you press it, and back to what it was before when you release it again.

If you find that it stays low after you release the switch, then you know it's the switches fault. Get a new one...
__________________

  #7   Spotlight this post!  
Unread 26-04-2005, 17:29
stephenthe1 stephenthe1 is offline
Registered User
#1008
 
Join Date: Dec 2004
Location: Ohio
Posts: 113
stephenthe1 is on a distinguished road
Re: limit switches

I think the switch is ok. The problem is, once pressed, the value I use to reference it in the code (rc_dig_in08 == 0) when it is released, does not recognize that it is released. It recognizes in the code when it changes to one, though (rc_dig_in08 == 1) when it is pressed, but upon release, it doesn't change back to zero. Would this be code, I don't think so anyways, but I have my doubts as to whether it is hardware, because my code is such that the motor should only turn if the rc_dig_in08 == 0, and once the switch is released, and I press the button to turn the motor, it acts as if the rc_dig_in08 did indeed return back to 0, it's normal state. This really perplexes me. If you want to see my code, just respond and ask and I'll show you, it's very simple. My Mentor thinks it's possible we have a limit switch, that remembers its state, and upon release of the switch, it stays that way instead of returning back to it's 0 state. I hope this made sense, if not (I'm slightly confused myself!), I'll post the code, and will try to provide wiring details on our limit switch on Thursday. Thank you for you help!
  #8   Spotlight this post!  
Unread 26-04-2005, 17:46
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: limit switches

Quote:
Originally Posted by stephenthe1
...the value I use to reference it in the code (rc_dig_in08 == 0) when it is released, does not recognize that it is released. It recognizes in the code when it changes to one, though (rc_dig_in08 == 1) when it is pressed, but upon release, it doesn't change back to zero...
If you have the switch wired properly, between SIG and GND, the digital input will read 1 when the switch is open, and 0 when the switch is closed.

Please post the part of the code that isn't doing what you expect it to do.
  #9   Spotlight this post!  
Unread 26-04-2005, 18:34
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: limit switches

Try adding a printf to your code, see what it puts out.

printf("Limit Switch: %f \n", rc_dig_in08);
__________________
http://www.mikesorrenti.com/
  #10   Spotlight this post!  
Unread 27-04-2005, 00:29
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,112
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: limit switches

Quote:
Originally Posted by MikeWasHere05
printf("Limit Switch: %f \n", rc_dig_in08);
I thought the printf() we have didn't support the %f format. Even so, you want %d anyway.
  #11   Spotlight this post!  
Unread 28-04-2005, 12:44
eugenebrooks eugenebrooks is offline
Team Role: Engineer
AKA: Dr. Brooks
no team (WRRF)
 
Join Date: Jan 2004
Rookie Year: 2001
Location: Livermore, CA
Posts: 601
eugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond reputeeugenebrooks has a reputation beyond repute
Re: limit switches

Quote:
Originally Posted by MikeWasHere05
Try adding a printf to your code, see what it puts out.

printf("Limit Switch: %f \n", rc_dig_in08);
printf("Limit Switch: %d \n", (int)rc_dig_in08);

Both the %d and (for our RC compiler) the cast to int are important...
  #12   Spotlight this post!  
Unread 28-04-2005, 19:04
Mike's Avatar
Mike Mike is offline
has common ground with Matt Krass
AKA: Mike Sorrenti
FRC #0237 (Sie-H2O-Bots (See-Hoe-Bots) [T.R.I.B.E.])
Team Role: Programmer
 
Join Date: Dec 2004
Rookie Year: 2004
Location: Watertown, CT
Posts: 1,003
Mike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond reputeMike has a reputation beyond repute
Re: limit switches

Heh, yeah sorry about that. It is %d not %f. It's little (seemingly) trivial things like that that always get me.

eugene: I've never used (int) before, and my printf's work fine.
__________________
http://www.mikesorrenti.com/
  #13   Spotlight this post!  
Unread 29-04-2005, 01:06
CyberWolf_22's Avatar
CyberWolf_22 CyberWolf_22 is offline
Programming and Electrical Mentor
AKA: Allen Gregory
FRC #2587 (Afrobots)
Team Role: Mentor
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Houston, Texas
Posts: 227
CyberWolf_22 is just really niceCyberWolf_22 is just really niceCyberWolf_22 is just really niceCyberWolf_22 is just really nice
Re: limit switches

I am not sure if the question has been answered or not but I can't really diagnose the problem with out the code but what my first idea would be is that there is not an else statement following his if statement to turn the motor off when the switch is not pressed.

if (button8 == 1)
{pwm01 = 254;}
else
{pwm01 = 127;}


Wait, after rereading some of the posts maybe this is not the problem.
Please post your code so we can further diagnose it.
__________________

Last edited by CyberWolf_22 : 29-04-2005 at 01:09.
  #14   Spotlight this post!  
Unread 05-05-2005, 11:45
stephenthe1 stephenthe1 is offline
Registered User
#1008
 
Join Date: Dec 2004
Location: Ohio
Posts: 113
stephenthe1 is on a distinguished road
Re: limit switches

thanks for all your help. I've got it working now. the problem was just in how I was accessing the limit switch in the code. there was a variable that wasn't being reset when the switch changed its state. thanks for all your help. Originally, this wasn't the only problem, we had problems wth our buttons that kept messing me up too. but now that's all solved. thanks for the help!!!
the code you posted worked fine. thanks again.
  #15   Spotlight this post!  
Unread 10-05-2005, 13:10
Gamer930's Avatar
Gamer930 Gamer930 is offline
Team 930 and 171 Alumni
AKA: Justin
no team
Team Role: Alumni
 
Join Date: Mar 2002
Rookie Year: 2002
Location: New Berlin, WI
Posts: 388
Gamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to beholdGamer930 is a splendid one to behold
Re: limit switches

I searched and couldn't find and couldn't think through the code for:

I have a motor and 2 Limit Switches that sets the upper and lower limits of an arm from our 2003 Robot.

I want to have it so when I hit a Trigger on the joystick it sends the motor forward until it hits the Top limit switch or if it is already at the top to reverse the motor until it hits the Bottom Limit Switch.

I have:
#define T_DRIVE pwm01
#define Up_T_Limit rc_dig_in01 /* Limit Switch on Full Up Set */
#define Down_T_Limit rc_dig_in02 /* Limit Switch on Full Down Set */
#define T_BUTTON_BTN p2_sw_trig /* Button to change T state. */
/* T state variable. */
int intTState = 0;

Thanks in advance

<slightly off topic> This is for an off season project to convert our PBASIC 2003 robot into a vision robot for presentations </slightly off topic>
__________________
2010 to Present, Scorekeeper/Field Power Volunteer for FRC/FTC/FLL
2005 - 2010, Team 171 College Mentor
2002 - 2005, Team 930 Student
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
Common Ground on Limit Switches Gary Bonner Electrical 4 18-02-2005 13:24
Robot Controller File Size Limit ?? RoboGeek Programming 1 17-01-2005 19:59
material cost limit haverfordfords Fundraising 3 06-12-2004 19:21
Limit Switches help. Xufer Programming 9 21-04-2004 21:21
Need help with custom switches archiver 2001 3 24-06-2002 00:35


All times are GMT -5. The time now is 08:59.

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