Skip to content

Instantly share code, notes, and snippets.

@carneeki
Created February 2, 2013 20:27
Show Gist options
  • Save carneeki/4699115 to your computer and use it in GitHub Desktop.
Save carneeki/4699115 to your computer and use it in GitHub Desktop.
possible tachometer for plugging in to PIDController / PIDSubsystem
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