Created
February 2, 2013 20:27
-
-
Save carneeki/4699115 to your computer and use it in GitHub Desktop.
possible tachometer for plugging in to PIDController / PIDSubsystem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package first.frc.landownunder.components; | |
import edu.wpi.first.wpilibj.Counter; | |
import edu.wpi.first.wpilibj.DigitalInput; | |
import edu.wpi.first.wpilibj.PIDSource; | |
/** | |
* A tachometer using DigitalInput high pulses. | |
* @author carneeki | |
* @since 2012-02-03 05:05AEDT | |
*/ | |
public class Tachometer extends Counter implements PIDSource | |
{ | |
public Tachometer(DigitalInput tacho) | |
{ | |
super(tacho); | |
} | |
/** | |
* @return return output in RPM since last count | |
*/ | |
public double pidGet() | |
{ | |
return 60/getPeriod(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment