5 #include "QuantizedPot.h" 16 for (int8_t i=0; i<_rangeMax; i++) {
24 if (_ranges != NULL) {
25 for (int8_t i=0; i<_rangeMax; i++) {
26 if (_ranges[i] != NULL) {
38 if (_rangeCount >= _rangeMax) {
42 if (_ranges[_rangeCount] != NULL) {
43 delete _ranges[_rangeCount];
52 _threshold = threshold;
60 if (DoEvery(_delay, _lastUpdate)) {
61 int8_t valueNow =
_value();
62 if (valueNow != _state) {
64 if (_counter > _threshold) {
67 }
else if (_counter > 0) {
81 int raw = analogRead(_pin);
82 _velocity = raw - _lastRaw;
84 for (int8_t i=0; i<_rangeCount; i++) {
85 if (_ranges[i]->contains(raw)) {
92 void QuantizedPot::setState(int8_t newState)
94 _lastStateChange = Millis();
int8_t addRange(int start, int end)
QuantizedPot(const uint8_t pin, int8_t maxRanges)
void begin(uint8_t threshold=AbstractDebouncedButton::DefaultThreshold, uint8_t delay=AbstractDebouncedButton::DefaultButtonDelay)