MCPcopy Create free account
hub / github.com/FastLED/FastLED / Potentiometer

Method Potentiometer

src/fl/sensors/potentiometer.cpp.hpp:30–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28// ============================================================================
29
30Potentiometer::Potentiometer(int pin, u16 hysteresis)
31 : mPot(pin), mListener(this), mHysteresis(hysteresis) {
32 // Initialize calibration range to full ADC range
33 mMinValue = 0;
34 mMaxValue = getAdcMaxValue();
35
36 // Read initial value
37 mCurrentValue = mPot.read();
38 mLastValue = mCurrentValue;
39
40 // Auto-calculate hysteresis if not specified (1% of calibrated range)
41 if (mHysteresis == 0) {
42 mHysteresis = calculateDefaultHysteresis();
43 }
44}
45
46float Potentiometer::normalized() const {
47 // Handle invalid range

Callers

nothing calls this directly

Calls 1

readMethod · 0.45

Tested by

no test coverage detected