Stopping Motion in One Direction

Limit Switches seem to be useful for stopping, say, an arm from smashing into the ground and causing drag. I have been trying to set up the code so that when the limit switch is triggered, Motor 8 will no longer turn clockwise and Motor 9 will no longer turn counterclockwise.

I am at the point where I can make something happen when the limit switch is depressed. I cannot, however, make the motor only receive input for one direction. I was unable to find a block that did this, and as I have no knowledge of coding outside of Easy C I find myself stumped.

If it matters, I am using Easy C V4, and a Cortex.

There are two blocks in easyC V4 under the Joystick group.

Joystick to Motor & Limit
Joystick Digital to Motor & Limit

These blocks should do the trick. If you need some help, drag in the block to your program and select the Help button to see an example.

Hope this helps.

I found the block, but apparently I fail to understand how to use it.

Let’s say that when Limit Switch 1 is triggered, I want Motor 8 (which is inverted on the controller) to no longer turn counter-clockwise, and Motor 9 (which is NOT inverted) to no longer turn clockwise. When Limit Switch 2 is triggered, Motor 8 should cease turning CW, and Motor 9 should not turn CCW any more.

They are on the second Joystick, and the left joystick, hence the stuff at the top of the images attached. Can someone please explain what I’m doing wrong? This seemed so simple before.


Have you tested the motors and switches independantly and check that they working in the online window?

Yeah, everything works independently. It’s just not working together.

We’ve had to work without them for the last few months, but hey. It’s made us think of some weird stuff.

If anyone can help, though, I’d like to know what in blazes is wrong with it.

Can you e-mail a copy of your code to [email protected] ??

Otherwise you could write your own function using an IF Statement