Class SpeedSensorHelper

java.lang.Object
com.opensourcewithslu.inputdevices.SpeedSensorHelper

public class SpeedSensorHelper extends Object
The SpeedSensorHelper class initializes the speed sensor and provides component functionality
  • Constructor Details

    • SpeedSensorHelper

      public SpeedSensorHelper(com.pi4j.io.gpio.digital.DigitalInput sensorPin, double pulsesPerRevolution)
      Constructs a new SpeedSensorHelper instance.
      Parameters:
      sensorPin - The DigitalInput pin for receiving the pulse from the speed sensor.
      pulsesPerRevolution - Number of pulses per revolution from the speed sensor.
  • Method Details

    • initialize

      public void initialize()
      Initializes the speed sensor
    • startMeasuring

      public void startMeasuring()
      Begins measuring speed and calculating RPM at regular intervals
    • getRPM

      public double getRPM()
      Returns the speed in RPM.
      Returns:
      The speed value in RPM.
    • stopMeasuring

      public void stopMeasuring()
      Stops the sensor measurement.