|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
|||
|
|||
|
Re: Limit Switch Draws Tears
Focusing on the limit switch problem:
1. It should be referred to as DigitalInput (1) or DigitalInput (4,1) - nothing else. The first number refers to the slot where your digital module is - in this case Slot 4. 2. Make sure your switch itself is a normally Open type switch Switches come as Normally Open and Normally Closed - closed will always show one unless it is operated in a different way. You can check this using a multimeter. |
|
#17
|
||||
|
||||
|
Re: Limit Switch Draws Tears
Quote:
There are many times when you want a NC switch. This is particularly true of limit switches. If a wire breaks and the switch is no longer "in the circuit" you want the motor or actuator that you are limiting to stop. This is usually much safer... Regards, Mike |
|
#18
|
|||
|
|||
|
Re: Limit Switch Draws Tears
Yes yes yes, we understand the dynamics of how a switch works
The third condition was just an act of desperation, seeing if anything would work. The switch itself is perfect. It is wired up correctly and everything as previously stated. I believe where our problem lies is within the coding. I think it is declared properly, yet the switch refuses to recognize a closed position. I blame Fate. |
|
#19
|
||||
|
||||
|
Re: Limit Switch Draws Tears
Quote:
How do you expect anyone to help you? Mike |
|
#20
|
|||||
|
|||||
|
Re: Limit Switch Draws Tears
It is abundantly clear that the code is broken, as has been pointed out to you by multiple people. Please please please please read the responses telling you exactly what line is totally wrong (hint: it's the one saying DigitalInput(1,1), and should be changed to DigitalInput(4), assuming your limit switch is on DIO 4 of a Digital Sidecar connected to the module in slot 4).
Quote:
|
|
#21
|
||||
|
||||
|
Re: Limit Switch Draws Tears
Make sure your limit switch is wired up between the Signal and Ground wires (and NOT Signal and Power). Signal and Ground are the only two wires you need for a simple limit switch.
Double check with a meter with the switch connected and robot powered on that the voltage across the switch changes from 0 to 5V. I know this might be something you have already done, however I've run into many teams that try and wire the Power and Signal wires to the switch, and verify that the "switch works" by just checking whether the resistance across the switch goes to 0 |
|
#22
|
|||
|
|||
|
Re: Limit Switch Draws Tears
Now here is where things get interesting. We have read and tried all of the above solutions AND the reason why we posted the code was so that you could better understand our situtation. Just because we had 3 conditions for a boolean operation does not constitute snotty remarks. It is very eaasy to ignore the third condition as that is not our main problem. I think it is you that must read our responses to the solutions posted. Thank you Mr. Lim and those of you who posted solutions, we have tried all of them , but failure seems too proud to leave us this day.
|
|
#23
|
||||
|
||||
|
Re: Limit Switch Draws Tears
Quote:
You originally said that you had two limit switches wired to DI 4 on the digital sidecar. You then posted a code fragment with this: Dig1 = new DigitalInput(1, 1); which is an example of code that can not possible work. Why? The Analog I/O module must be in slot #1. I replied that the code fragment should have been Dig1 = new DigitalInput(4, 4); assuming the digital I/O module is plugged into slot 4 of the cRIO. You then replied that you had "tried all of the possible solutions" and I asked you to tell us exactly how the switches are wired. You did not. The discussion of three conditions came about because you asked. I merely said that you had more than one issue... I also asked you to tell us what you were trying to accomplish. You did not. The discussion of normally open versus normally closed was especially pertinent as we still do not know how the TWO switches are wired. Since you will not tell us how things are wired we have to guess... Two normally open switches, wired in series and operated one at a time will never close a circuit and always return a 1 in your code... This is an example of why limit switches are almost always wired as normally closed. You were asked to explain your wiring. You did not... You posted code which could not work and you knew that it could not work because you are addressing the analog module... And somehow you infer that we are to blame because we can not read your mind... I am done here... Good luck Mike |
|
#24
|
||||
|
||||
|
Re: Limit Switch Draws Tears
z2daj,
You need to understand that the CD community consists of VERY good mentors who pretty much could solve your problem in a matter of seconds if they were there and able to collect the information they need. What you perceive as a snotty remark is probably a bit a frustration on our part by the inability to get the information we need. It's a limit switch, and we want to get you up and running ASAP. Can you answer these questions for us? 1. Does your switch, when hooked up with the robot powered on, measure 5V and then change to 0V across the terminals when you press and release your switch? 2. Where exactly is your switch hooked up on the digital side car? Digital I/O 4? Not relays, or PWM? 3. Is there anything else hooked up to this Digital Side Car? Speed controllers? Other switches/sensors? 4. Do these other items on the Digital Side Car work? Are all the green LEDs on? 5. Where is the Digital Side Car hooked up to on the cRIO? To a DIO module in slot 4? Using the originally supplied cable? Are the thumbscrews screwed in? 6. If your switch is hooked up to digital input 4 on the digital side car, and the digital sidecar is hooked up to the cRIO through a DIO module in the fourth slot (fourth counted from the end with the power connector) then your initialization should be: Code:
Dig4 = new DigitalInput(4); 6. Add a printf line to the end of your teleop code: Code:
printf("DIO4: %d\n",Dig4->Get());
8. The Target Console should now spit out the state of your switch continuously. Does it ever switch from 1 to 0 when you press your switch? 9. Are there any experienced teams in your area you can contact? Two days to burn on a limit switch is too much, and if I were in your shoes, I'd get help in person ASAP. FIRST is a wonderful thing - I'm sure someone would be willing. |
|
#25
|
|||
|
|||
|
Re: Limit Switch Draws Tears
Ok guys, after re-reading my posts, I would like to apologize for my rudeness. I let my frustration get the better of me. I left it alone for awhile and let somebody else take control. He told me later that he got it working, although I didn't get to ask how due to the snow.
Thank you all for everything and good luck to you and your teams during these final days of the build season. -Zach Jasensky |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| limit switch | solomason519 | Programming | 9 | 09-02-2010 08:50 |
| Using a limit switch to limit motion | ManicMechanic | Programming | 16 | 20-12-2007 00:54 |
| limit switch | wedellm | Electrical | 4 | 16-02-2007 13:01 |
| Limit Switch Basics | JWSnedden | Programming | 6 | 30-11-2006 19:48 |