Class SpeedSensorHelper
java.lang.Object
com.opensourcewithslu.inputdevices.SpeedSensorHelper
The SpeedSensorHelper class initializes the speed sensor and provides component functionality
-
Constructor Summary
ConstructorsConstructorDescriptionSpeedSensorHelper(com.pi4j.io.gpio.digital.DigitalInput sensorPin, double pulsesPerRevolution) Constructs a new SpeedSensorHelper instance. -
Method Summary
Modifier and TypeMethodDescriptiondoublegetRPM()Returns the speed in RPM.voidInitializes the speed sensorvoidBegins measuring speed and calculating RPM at regular intervalsvoidStops the sensor measurement.
-
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.
-