Go to Post We can't turn off inspiration and recognition, development and learning with a switch. It is an on-going process. If it were not, there would be no need for CD except for 6 weeks out of the year. - JaneYoung [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #13   Spotlight this post!  
Unread 17-02-2016, 20:13
Lesafian Lesafian is offline
Registered User
AKA: Jeremy Styma
FRC #6077 (Wiking Kujon)
Team Role: Programmer
 
Join Date: Feb 2016
Rookie Year: 2016
Location: Posen, Michigan
Posts: 22
Lesafian is an unknown quantity at this point
Re: Issues with LimitSwitch

Quote:
Originally Posted by rich2202 View Post
At the beginning of OperatorControl, you check the limit switch, and stop slidemotor if it the switch is true.

So, make sure the limit switch returns 1 (true) when it is reached, and 0 (false) when it is not.

However, you code continues to execute, and at:


you set the speed of the motor, without regard to the limit switch.
So would something like this fix it?

Code:
			if (limit1.get() == true) {
				
				slideMotor.stopMotor();
				
			} else if (limit1.get() == false) {
				
				if (Math.abs(xboxController.getRawAxis(5)) > .1) {
					
					slideMotor.set(xboxController.getRawAxis(5));
					
				} else {
					
					slideMotor.stopMotor();
					
				}
			}
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 12:04.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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