Joystick Button One-Shot (a.k.a. Rising Edge) Detection

We are using a speed controller to power a Denso window motor BUT we could use a Spike if it would be easier.

Just to clarify-
We want a ramp to move UP when button 1 is pressed AND only when button 1is pressed. We want the ramp to go DOWN when button 2 is pressed AND only when button two is pressed.

Our issue is we need the ramp to stop when the ramp is all the way down, hence the need for a switch. We don’t want to rely on the driver seeing that the ramp is down and letting go of the button in time. The plastic hex output shaft on the Denso window motor is awfully susceptible to shear.

Thanks for the help.

Controlling a motor with a pair of buttons is not difficult. Use the state of the first button to select between the True and False of a case block, wiring a constant zero out of the False case and wiring the desired “UP” motor speed out of the True case. Run that output through another case block controlled by the second button, wiring the value straight through without modification in the False case and wiring the desired “DOWN” motor speed out of the True case. Run that output through the In Range and Coerce select block controlled by the limit switch; I showed an example of that a few posts ago.

Alan- Is this what you are describing?

switch test.jpg

switch test.jpg

Not quite. I suggest that the motor should be set only once at the end of the process, with just the numeric values that will be set going through the case blocks.

It looks like your ramp runs upward with -1 and downward with +1, so the “down” limit should prevent the value from going positive. Using -1 and 0 as the range limits will let it run upward but not downward when the limit input is active.

(The three “False” cases at the top are just there to show what’s going on in the bottom case blocks.)



Thanks for the life-ring. I think I understand how this works now.

Can I ask one more question? Can you explain the logic of the In Range and Coerce for this instance. I have read the context help but don’t understand how it works in this instance.

Thanks again!

In Range and Coerce takes a lower limit, an upper limit, and an input value. It then does two things.

1: It provides an “In Range” boolean output that is True when the value is between the limits, and False when the value is outside the limits. This feature is not used in the code I showed.

2: It provides a "Coerce"d output value that matches the input value when it is inside the limits, but does not exceed the limits in either direction when the input is outside the range. This is how the motor is kept from driving in a particular direction, by making sure the value never goes above 0.