|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Limit Switch Programming
@GoldenGollem: 1) what motor controller are you using? 2) would you please post a picture showing how you have the limit switch mounted. |
|
#2
|
||||
|
||||
|
Re: Limit Switch Programming
First off, thanks Engunner for the idea of using booleans to organize the code. I am using one limit switch to stop the motor from moving too far in the reverse. I am, however having issues with
Code:
if (intakeMotorForward && !limitSwitch ) {
|
|
#3
|
||||
|
||||
|
Re: Limit Switch Programming
Quote:
Code:
if (intakeMotorForward && (limitSwitch == false)) {
|
|
#4
|
|||
|
|||
|
Re: Limit Switch Programming
Quote:
Did you define the variable and assign a value to it (get the limit switch status)? |
|
#5
|
|||
|
|||
|
Re: Limit Switch Programming
Quote:
First, On top, where you declared Code:
DigitalInput limitSwitch; Code:
DigitalInput limitSwitch = new DigitalInput(x); Second, It's not just Code:
!limitSwitch Code:
!limitSwitch.get() |
|
#6
|
||||
|
||||
|
Re: Limit Switch Programming
Quote:
Code:
boolean intakeHitLimitInNegativeDirection = !limitswitch.get(); ...rest of code... For future code, consider looking at the command template. It feels more complicated than iterative, but certain concepts in command are far more powerful than iterative, and Robot Builder is a big benefit as well. |
|
#7
|
||||
|
||||
|
Re: Limit Switch Programming
@Ether
We are using a Talon SR motor control with the motor. I do not have a picture of the actual limit switch mount (we have just added it and we are not in the shop today). We have tested the mechanics behind it and that half of it should all work so we just need the coding aspect of it done. Thanks -GG |
|
#8
|
||||
|
||||
|
Re: Limit Switch Programming
Quote:
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|