|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
||||
|
||||
|
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!
|
|
#2
|
||||
|
||||
|
Re: Two limit switches, one button
Quote:
|
|
#3
|
||||
|
||||
|
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?
|
|
#4
|
|||||
|
|||||
|
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. |
|
#5
|
|||||
|
|||||
|
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. |
|
#6
|
|||
|
|||
|
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 |
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
Re: Two limit switches, one button
Quote:
|
|
#9
|
|||
|
|||
|
Re: Two limit switches, one button
So, given "Normally Open" port true on open (and wiring GND to Signal on the DIO through the switch) and a 2.0V ish to 0.8 ish transition holding below 0.8V for more than 20nS, we will see WPI_SwitchGetLimitValueReturn true, and WPI_SwitchGetCount will increment.
When does WPI_SwitchGetLimitValueReturn reset? On a transition from -0.8V to 2.0V longer than 20nS? The counter resets to zero on the call to Begin? And between autonomous and teleop? I keep getting challenged (good questions, mostly) on stuff like this, so the ducks need to line up TIA, Tim |
|
#10
|
|||||
|
|||||
|
Re: Two limit switches, one button
If the hardware is built so that the limit switch is not active when the mechanism is at the end of its travel, then what you describe is possible. I wouldn't suggest designing it that way.
|
|
#11
|
|||
|
|||
|
Re: Two limit switches, one button
Quote:
Thank you, Tim |
|
#12
|
|||
|
|||
|
Re: Two limit switches, one button
There have been some good comments posted here that I would recommend reading them - especially the one by cgmv123.
For those who are looking for more of a tutorial of one way of accomplishing this task - currently up while button 1 and not top limit switch else down while button 2 and not bottom limit switch - Please refer to this tutorial that I have made, Click here for tutorial It is under limit switch tutorial, although the state machine tutorial is a similar scenario. |
|
#13
|
||||
|
||||
|
Re: Two limit switches, one button
Thanks so much to everyone who gave their impute! They work like a charm!
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|