|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
||||
|
||||
|
Two limit switches, one button
Hey guys, this is my second year programming and have never programmed limit switches before. I know that there are a few other limit switch questions, but I want to use two switches (A top and bottom) and one button to control our lift motor. I was wondering if anyone could provide me with an example of how I could do this or if it is even possible. Anything is highly appreciated! Thanks!
|
|
#2
|
|||||
|
|||||
|
Re: Two limit switches, one button
You could use a state machine (in Teleop or Periodic Tasks) or a sequence (in Periodic Tasks only).
- push button - run up until limit switch is hit and stop - push same button (or a different one) - run down until limit switch is hit and stop If one button, then use a feedback node or shift registers to remember the previous direction. |
|
#3
|
||||
|
||||
|
Re: Two limit switches, one button
How can I do this with one motor? Whenever i try to connect them both, the wire breaks. I have tried using a "or" boolean but with no luck.
|
|
#4
|
|||||
|
|||||
|
Re: Two limit switches, one button
Do you want to control a motor using only one joystick button?
Tell us a story. Pretend that the program and wiring are done, and describe for us what the person at the controls does and what the robot does in response. Use phrases like "presses the button for a half second then releases it" and "lift starts moving up and doesn't stop until the top limit switch is activated." Make sure you cover every case that you want to handle. Then add some cases that you don't expect but might still happen, like "holds the button down even after the lift has reached the bottom" or "presses the button again while the lift is already moving upward". Once we know what you want the robot to do in response to the operator's actions, we can show you how to create code that will do it. |
|
#5
|
|||||
|
|||||
|
Re: Two limit switches, one button
How would you feel about using different buttons for up and for down?
I worry that with a single button you won't be able to control the direction the elevator is moving in, especially if a limit switch shifts or breaks. Do you have a mechanical brake to prevent the elevator from dropping without power when loaded with a tote (or not)? -hold the up button and it rises until the button is released or the limit switch is contacted. -hold the down button and it drops until the button is released or the limit switch is contacted. Last edited by Mark McLeod : 02-02-2015 at 10:18. |
|
#6
|
||||
|
||||
|
Re: Two limit switches, one button
We would be fine to use two buttons. We would like to push a button and have the motor move up and half speed and stop when the limit switch is hit, then hitting the same button (or another) and having the motor go down until the bottom limit switch is hit, and never stopping in the middle. I hope that clears up what we would like to!
|
|
#7
|
|||||
|
|||||
|
Re: Two limit switches, one button
The "never stopping in the middle" can be a problem if one of your limit switches doesn't work properly. You might want to rethink your decision to let the lift keep running after the button is released.
How much other stuff is the operator going to need to do while the lift is in transit? Would it be too much trouble for him or her to be required to keep the button pressed in order for the lift to keep moving? That would make the lift a lot less likely to destroy itself if something failed. |
|
#8
|
||||
|
||||
|
Re: Two limit switches, one button
After talking to my mentor, I had miss understood the intent of the limit switch, we DO want to want to have the motor run as long as the button is held, or the limit switch is hit, whichever comes first. I have figured out how to run the motor (up with button 1 and down with button 2) I could just use some help figuring out how to incorporate the two limit switches to turn the motor off. Any example would be highly appreciated!
|
|
#9
|
||||
|
||||
|
Re: Two limit switches, one button
Quote:
|
|
#10
|
||||
|
||||
|
Re: Two limit switches, one button
To tell you the truth, I'm not sure. We want the limit switches as a safety to stop the motor from from hitting the sprockets. I'm not sure what needs to be true and what needs to be false. I hope that helps?
|
|
#11
|
|||||
|
|||||
|
Re: Two limit switches, one button
Quote:
Now you have two boolean values, one saying "move up" and the other saying "move down". If you can't figure out how to use those values to control your lift motor, ask for more help. |
|
#12
|
|||||
|
|||||
|
Re: Two limit switches, one button
I suggest that when you test this you do it at some minimal power, e.g., .4, and hold each limit switch down at the start to verify that the switch matches the button direction.
The limit switch can be wired either Normal-Closed or Normally-Open and the boolean generated might be reversed from what you expect, i.e., it may be True when you expected False. Last edited by Mark McLeod : 02-02-2015 at 21:31. |
|
#13
|
|||
|
|||
|
Re: Two limit switches, one button
Quote:
We are scraping for documentation on the new Switch VI's. Are these implemented using the FPGA hardware, so it is sampling quick enough that any mostly full range edge is caught? Does the counter reset on system reset? Can we reset the counter? Any debouncing built in? Inquiring minds, Tim |
|
#14
|
|||
|
|||
|
Re: Two limit switches, one button
The limit switch is a simple wrapper over the DIO functions that were already available. They were added primarily for simulation. In order for a simulated robot to be able to identify how a digital line should toggle when something moves, it is useful to identify the switch, tell the physics engine where it is, how it is wired, etc. This is also true of the potentiometer. It is a simple wrapper over AI.
So the FPGA is doing the low level read and filter of the switch, but it is the RT side that is responsible for modifying a motor or other actuator in response. There is no new way to "tie things together" in the FPGA. Greg McKaskle |
|
#15
|
|||||
|
|||||
|
Re: Two limit switches, one button
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|