Page 1 of 1

How to use the same input to start and stop?

Posted: Mon Jun 21, 2021 6:37 am
by boston
I’m using a MCP233 to open/close a car scissor door via a momentary rocker switch. One position will open the door and the other position will close it. Pressing either while the door is in motion will stop the door. This type of control logic is also used for car windows, garage door openers, etc.

I can use a max action to stop the motor. However, the desired logic depends on the state of the motor. When I've done this type of thing before I've used an interrupt and placed the logic there - a simple if/else clause. It seems like the actions are basically interrupts that you can only hardwire to one of a set of operations. I considered monitoring the input in the script, but I can’t figure out how to do that. Please advise.

Re: How to use the same input to start and stop?

Posted: Wed Jun 30, 2021 7:01 pm
by Basicmicro Support
For that you will need to write a small MCL script. The actions can only be used for a single action per I/O.

In the script you will need to keep track of the last state. You will probably need to have a startup routine as well that will determine what the state of the door is.