|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: How do you program limit switches?
A motorized car jack that stops working when it goes too low or too high
|
|
#2
|
||||
|
||||
|
Re: How do you program limit switches?
DigitalInput name = new DigitalInput(slot)
fill in slot with the slot on the DIO that the switch is plugged into and name with whatever you want to call it. name.get() will return you the boolean indicating whether the switch is pressed or Unpressed. If it's wired right, true will be pressed and false will be unpressed |
|
#3
|
|||
|
|||
|
Re: How do you program limit switches?
Scissor jack? Very suave just to think of it.
|
|
#4
|
|||
|
|||
|
Re: How do you program limit switches?
Yup! We use it to change the angle of our shooter.
|
|
#5
|
||||
|
||||
|
Re: How do you program limit switches?
|
|
#6
|
|||
|
|||
|
Re: How do you program limit switches?
For some of you using command based programming, I noticed that the DigitalIOButton class wasn't working properly, so I programmed my own DigitalButton class using the very-functional DigitalInput class.
Code:
public class DigitalButton extends Button {
private int channel;
DigitalInput buttonInput;
public DigitalButton(int channel) {
this.channel = channel;
buttonInput = new DigitalInput(channel);
}
public int getChannel() {
return this.channel;
}
public boolean get() {
return buttonInput.get();
}
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|