Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Limit Switches (http://www.chiefdelphi.com/forums/showthread.php?t=138687)

Team5709 22-10-2015 20:27

Limit Switches
 
hello i ma a lead programmer from team 5709 the rudyard nerfherders and i was wondering how do i program limit switches to stop a motor from rotating a certain way when it is closed?

so if the elevator hits a limit switch on the bottom it will only be able to allowed to go up and not down anymore.

Certified Nerd 22-10-2015 21:14

Re: Limit Switches
 
I can't answer your question, but you will need to share the programming language you are using as well as weather you are using NC or NO for the limit switch. Once this info is provided someone on here should be able to help you.

Team5709 22-10-2015 21:51

Re: Limit Switches
 
i ma using java and i would like to know how to do it for them both

MaGiC_PiKaChU 22-10-2015 23:50

Re: Limit Switches
 
Hi,

The simple way to do this would be with an if statement:

Code:

double speed = getJoystickAxis();

if(limitswitch.get() && speed<0)
{
    speed=0;
}
motor.set(speed);

That makes your motor output 0 instead of a negative value when your switch is pressed, but still allows it to have a positive value

ShortCircuit908 23-10-2015 00:32

Re: Limit Switches
 
This topic has been explained more in-depth in a previous post: http://www.chiefdelphi.com/forums/sh...d.php?t=134642

You can probably find the best answer there.


All times are GMT -5. The time now is 10:16.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi