|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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.
|
|
#3
|
|||
|
|||
|
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
|
||||
|
||||
|
Re: limit switches
Quote:
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. |
|
#5
|
||||
|
||||
|
Re: limit switches
Quote:
If you find that it stays low after you release the switch, then you know it's the switches fault. Get a new one... ![]() |
|
#6
|
|||
|
|||
|
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!
|
|
#7
|
|||||
|
|||||
|
Re: limit switches
Quote:
Please post the part of the code that isn't doing what you expect it to do. |
|
#8
|
|||||
|
|||||
|
Re: limit switches
Try adding a printf to your code, see what it puts out.
printf("Limit Switch: %f \n", rc_dig_in08); |
|
#9
|
|||||
|
|||||
|
Re: limit switches
Quote:
|
|
#10
|
||||
|
||||
|
Re: limit switches
Quote:
|
|
#11
|
|||||
|
|||||
|
Re: limit switches
If I were a betting man, I would put money on it being a software problem.
First check the switch -- only because it's often easier to check hardware than to find a code problem. If it tests OK, then it is more than likely a software problem. (It could still be the controller, but unless you had a fairly major oopsie with it, I doubt it.) After you've tested the switch, post the code, and we'll help you find the problem. |
|
#12
|
|||
|
|||
|
Re: limit switches
This is definitely a simple matter of testing for the wrong value in code. Digital inputs on the RC (but not on the OI) have "pull ups", which means they are set to register as 1 in software when not grounded. Your input will be in the 0 state when the switch is pressed. This isn't a problem at all, just invert where you have tests for 1s and 0s.
|
|
#13
|
|||
|
|||
|
Re: limit switches
actually, limit switches are the opposite of that. They are normally 0, or true, then once pressed, turn to 1. I'm trying to find the code I used, but I think it's on my flash drive some where where I can't fine it. I'll post tomorrow with results and code. Thanks for all the help!!!
or wait, do you mean that they've actually 'simplified' it for us, by reversing the values in the code we work with, so I should use == 1 to test for being pressed? that would make a lot of sense, because I thought the joysticks were supposed to be == 0 when pressed, but it only worked when I did == 1. thanks for the information. Why don't they tell people these small, but important things. Thanks! Last edited by stephenthe1 : 27-04-2005 at 17:55. |
|
#14
|
|||
|
|||
|
Re: limit switches
Er, unless I'm severely mistaken, it's ==0 for when a digital input is grounded, ==1 for when it's not grounded, ==0 for an unpressed joystick button, and ==1 for a pressed joystick button. Unless your switch grounds when inactive and removes the contact when it's activated, you do test for ==0 (or !rc_dig_in01) to tell when the switch is active. Page 14 of the 2004 Programming Reference Guide describes it.
Actually, it appears that the guide makes no exception for the OI inputs, so perhaps it's possible that the joysticks that we typically use *are* of the second kind of switch, that breaks a ground connection instead of establishing one. The 2005 OI Guide mentions on page 5 that an OI digital input senses a ground connection to "become active". Ok, so I'm beginning to doubt some of what I've said, but I'm still fairly certain that the RC switch is logically true in code when ungrounded. |
|
#15
|
||||
|
||||
|
Re: limit switches
Quote:
Quote:
Quote:
Quote:
![]() I can never remember/am never sure which it is, so I setup #defines at the beginning of a include file I put all that general setting stuff in, then use that in my tests. IE: PHP Code:
Last edited by Ryan M. : 28-04-2005 at 10:10. Reason: Missed my closing code tag |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |