|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Waiting Until Limit Switch Is Pressed
I would recommend hooking the limit switch up to the Jaguar, so it automatically turns itself off. No code required.
Read the Jaguar's datasheet to determine how the limit switch functionality works and where you need to hook it up to. |
|
#2
|
|||||
|
|||||
|
Re: Waiting Until Limit Switch Is Pressed
Quote:
Just put a while loop in the frame, reading the limit switch inside the loop and using the returned value as the termination condition for the loop. It'll keep looping until the switch is activated. Be sure to also put a 10 ms delay (or thereabouts) inside the loop so it doesn't use up all the CPU cycles just waiting for the switch. In this case, code is definitely required. This is a sequence of events that waits at one step until the switch is hit, so the program needs to be reading the switch. |
|
#3
|
|||
|
|||
|
Re: Waiting Until Limit Switch Is Pressed
Is 10MS good enough to catch one of those switches with the lever arm and roller on the end? I am fretting about catching the signal in time to prevent arms slamming into supports.
I am almost wishing for interrupt driven controls here. Is there a way? Tim |
|
#4
|
||||
|
||||
|
Re: Waiting Until Limit Switch Is Pressed
Quote:
HTH |
|
#5
|
||||
|
||||
|
Re: Waiting Until Limit Switch Is Pressed
i dont know what language your using, but in java it would look something like this
Code:
if(!limitSwitch.get()){
motor.set(1.0);
}else if(limitSwitch.get()){
motor.set(0.0);
}
Code:
if(!limitSwitch.get()){
motor.set(1.0);
}else if(limitSwitch.get()){
motor.set(0.0);
}else if(controller.getRawButton(1)){
motor.set(1.0);
}
|
|
#6
|
|||||
|
|||||
|
Re: Waiting Until Limit Switch Is Pressed
When we're worried that we might miss a brief switch input between samples, we open the input as a counter instead. Then we watch for the counter to change values, and that tells us the switch was hit.
If something pulses quickly enough to be missed by the FPGA, we've already got some re-engineering to do. |
|
#7
|
|||
|
|||
|
Re: Waiting Until Limit Switch Is Pressed
This is as much a question of programming as it is of limit switch positioning.
It's often easier to modify the limit switch position to solve end position problems like this. |
|
#8
|
||||||
|
||||||
|
Re: Waiting Until Limit Switch Is Pressed
I would be less worried about detecting the limit switch as I would stopping a fast moving part with a lot of inertia. Programming can only minimally impact the latter.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|