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, 1023, this->mini, this->maxi);
32 #ifdef COMMANDERS_DEBUG_MODE 34 Serial.println(F(
"This potentiometer have no ID defined : call begin() !"));
37 int val = analogRead(this->pin);
39 val = map(val, 0, 1023, this->mini, this->maxi);
41 if (val < this->currentValue - this->moveAccuracy || val > this->currentValue + this->moveAccuracy)
43 #ifdef COMMANDERS_DEBUG_MODE 44 Serial.print(F(
"Potentiometer new value : "));
45 Serial.println(val, DEC);
47 this->currentValue = val;
54 #ifdef COMMANDERS_PRINT_COMMANDERS 55 void ButtonsCommanderPotentiometer::printCommander()
57 Serial.print(F(
" Potentiometer - Pin:"));
58 Serial.print(this->pin);
59 Serial.print(F(
" / Mini: "));
60 Serial.print(this->mini);
61 Serial.print(F(
" / Maxi: "));
62 Serial.print(this->maxi);
63 Serial.print(F(
" / Accuracy: "));
64 Serial.println(this->moveAccuracy);
static unsigned long RaiseEvent(unsigned long inId, COMMANDERS_EVENT_TYPE inEvent = COMMANDERS_EVENT_MOVEPOSITIONID, int inData = 0)