There are a few methods. You could used command based programming, and then use it as such (assuming you're using a spike relay, aka bridge driver to control the solenoid):
Code:
public ShootFrisbee() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
requires(shooterSubsystem);
setTimeout(0.25);
}
// Called just before this Command runs the first time
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
shooterSubsystem.shootSolenoid(Relay.Value.kOn);
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return isTimedOut();
}
// Called once after isFinished returns true
protected void end() {
shooterSubsystem.shootSolenoid(Relay.Value.kOff);
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
}
If you want to just use the SimpleRobot, then using java's built in delay command should work (solenoid is the relay object in this block)
Code:
solenoid.set(Relay.Value.kOn);
wait(0.25);
solenoid.set(Relay.Value.kOff);
Of course, the second example's block of code should be run in a separate thread so the wait(0.25) function does not clog up your robot's "docket".