Hi,
So we are trying to utilize a pair of Allen-Bradley Color Mark Sensors for autonomous. I am simply having trouble coding such a thing. I am sure I could figure it out once I got started but a little push in the right direction would be pretty cool right about now. If any one could help with simply declaring the sensors, it would be much appreciated. Thanks!
Wiring:
brown = 12V+
blue = 12V-
black = DIO signal pin on roboRIO (plugged into port 0 for this example)
white = not needed
Use the DigitalInput class to get the status. Java subsystem below:
public class ExampleSubsystem extends Subsystem {
private DigitalInput sensor;
public ExampleSubsystem() {
sensor = new DigitalInput(0);
}
public void initDefaultCommand() {
}
public boolean isSwitched() {
return sensor.get();
}
}
1 Like