Package com.grt192.sensor

Source Code of com.grt192.sensor.GRTGearToothCounter

package com.grt192.sensor;

import com.grt192.core.Sensor;
import edu.wpi.first.wpilibj.GearTooth;
import edu.wpi.first.wpilibj.PIDSource;

/**
* A hall-effect, geartooth counting sensor driver
* @author Student
*/
public class GRTGearToothCounter extends Sensor{

    private GearTooth gearTooth;

    public GRTGearToothCounter(int channel,
                               boolean directionSensitive,
                               int pollTime,
                               String id) {
        gearTooth = new GearTooth(channel, directionSensitive);
        setSleepTime(pollTime);
        setState("Count", 0.0);
        this.id = id;
    }



    public void poll() {
        setState("Count", gearTooth.get());
    }

    public String toString() {
        return "Gear tooth counter";
    }
}
TOP

Related Classes of com.grt192.sensor.GRTGearToothCounter

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.