Potentiometer last change value

HI All,

How to get the last change value of potentiometer after the knob is stop rotating?

Could you give a bit more insight as to what you need. you are reading the resistance value of potentiometer but what do u need exactly?

Perhaps something like

prevPotVal = potVal;
potVal = analogRead(potPin);

Or, as @Chaitanya1 has said, give us more information.

...R

int c_dim1pot = analogRead(POT1_pin);

As I rotate the pot knob, c_dim1pot will either keep incremented or decremented based on the rotation direction.

I want to know the value after the knob has stopped rotating and not the values while it is rotating.

It doesn't matter if it's moving or not, surely...

When you take the reading, that's its value at that instant. If it had just stopped, or is about to move again, it's still its value.

Perhaps you should tell what it is you're trying to achieve?

I want to sent the pot value to openhab over RFM69HW radio network, issue is, as I rotate the knob the value is sent over the network which I want to avoid and send only once the final value.

Ah so you mean you want to sense that it's stopped turning?

Then so do what Robin2 suggested in #2, but then compare prevPotVal with potVal and if they are the same the pot has stopped moving.

A refinement might be to add some timing to check if the values have been the same for (say) 2-3 seconds.

Personally, I'd consider a more positive or concrete method and push a button to send it explicitly rather than relying on the pot to have stopped when it might actually just be finger trouble moving it unsteadily.