8 #ifndef NO_BUTTONSCOMMANDER 9 #ifndef NO_BUTTONSCOMMANDERPOTENTIOMETER 18 this->mini = inMinimum;
19 this->maxi = inMaximum;
21 this->moveAccuracy = inMoveAccuracy - 1;
22 if (this->moveAccuracy <= 0)
23 this->moveAccuracy = 1;
25 digitalWrite(this->pin, HIGH);
26 int val = analogRead(this->pin);
27 this->currentValue = map(val, 0, ANALOG_LIMIT, this->mini, this->maxi);
32 #ifdef COMMANDERS_DEBUG_MODE 35 if (this->moveAccuracy != 32767)
38 Serial.println(F(
"This potentiometer have no ID or pin defined : call begin() !"));
39 this->moveAccuracy = 32767;
49 int val = analogRead(this->pin);
50 #ifdef COMMANDERS_DEBUG_MODE 55 val = map(val, 0, ANALOG_LIMIT, this->mini, this->maxi);
57 if (val < this->currentValue - this->moveAccuracy || val > this->currentValue + this->moveAccuracy)
59 #ifdef COMMANDERS_DEBUG_MODE 60 Serial.print(F(
"Potentiometer new value : "));
61 Serial.println(val, DEC);
63 this->currentValue = val;
70 #ifdef COMMANDERS_PRINT_COMMANDERS 71 void ButtonsCommanderPotentiometer::printCommander()
73 Serial.print(F(
" Potentiometer - Pin:"));
74 Serial.print(this->pin);
75 Serial.print(F(
" / Mini: "));
76 Serial.print(this->mini);
77 Serial.print(F(
" / Maxi: "));
78 Serial.print(this->maxi);
79 Serial.print(F(
" / Accuracy: "));
80 Serial.println(this->moveAccuracy);
static unsigned long RaiseEvent(unsigned long inId, COMMANDERS_EVENT_TYPE inEvent = COMMANDERS_EVENT_MOVEPOSITIONID, int inData = 0)