Package com.grt192.actuator

Source Code of com.grt192.actuator.GRTRelay

package com.grt192.actuator;

import com.grt192.core.Actuator;
import com.grt192.core.Command;
import edu.wpi.first.wpilibj.Relay;

/**
*
* @author Student
*/
public class GRTRelay extends Actuator {

    public static final double RELAY_FORWARD = 1.0;
    public static final double RELAY_REVERSE = -1.0;
    public static final double RELAY_OFF = 0.0;
    private Relay relay;
   

    public GRTRelay(int channel) {
        relay = new Relay(channel);
    }

    public void executeCommand(Command c) {
        if (c.getValue() == RELAY_OFF) {
            relay.set(Relay.Value.kOff);
        } else if(c.getValue() == RELAY_FORWARD) {
            relay.set(Relay.Value.kForward);
        } else if(c.getValue() == RELAY_REVERSE) {
            relay.set(Relay.Value.kReverse);
        }
    }

    public void halt() {
        relay.set(Relay.Value.kOff);
    }

    public String toString() {
        return "Relay";
    }
}
TOP

Related Classes of com.grt192.actuator.GRTRelay

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.