Package edu.stuy.subsystems

Source Code of edu.stuy.subsystems.BallLight

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package edu.stuy.subsystems;

import edu.stuy.RobotMap;
import edu.stuy.commands.BallLightUpdate;
import edu.wpi.first.wpilibj.Relay;
import edu.wpi.first.wpilibj.command.Subsystem;

/**
* Light that turns on when the conveyor upper sensor is triggered.
* @author admin
*/
public class BallLight extends Subsystem {
    private Relay ballLight;
    private boolean isOn = false;
    // Put methods for controlling this subsystem
    // here. Call these from Commands.
   
    public BallLight() {
        ballLight = new Relay(RobotMap.BALL_LIGHT, Relay.Direction.kForward);
    }
   
    public void setLight(boolean on) {
        // Sets the light and the light state variable
        ballLight.set((isOn = on) ? Relay.Value.kOn : Relay.Value.kOff);
    }

    public boolean isOn() {
        return isOn;
    }

    public void initDefaultCommand() {
        // Set the default command for a subsystem here.
        //setDefaultCommand(new MySpecialCommand());
        setDefaultCommand(new BallLightUpdate());
    }
}
TOP

Related Classes of edu.stuy.subsystems.BallLight

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.