Skip to content

Rotary encoder — set position (encoder_set)

What it does: Sets the internal position of the encoder to the specified value (eg when zeroing or synchronizing).

encoder_set

Inputs

  • Val: new encoder position.
  • Field index: encoder instance selection.

Output

  • None (statement block).

When to use it

  • After starting the system to reset the reference position.
  • When synchronizing UI values with physical encoder.

Tips and pitfalls

  • When setting the position, the internal step accumulator is also reset.

Usage example

example_encoder.png

Open example in ESP IDE

Generated Python example

encoder1.position = 0