Skip to content

Rotary encoder example #56

Closed Answered by VasilKalchev
malaki86 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, @malaki86. Sorry for the delay.

Since you want to use the encoder's inputs for 3 different actions, you need to have a variable holding the current state of the encoder (the action it is doing currently). And you can use the buttons (short-press and long-press) to manipulate the encoder's state.

enum EncoderState : uint8_t {
    ENC_ST_SCREEN = 0, // in this state the encoder cycles the screens
    ENC_ST_LINE = 1, // in this state it cycles the focus through the lines
    ENC_ST_SETTING = 2, // in this state it "increases or decreases" the value of a setting
    ENC_ST_OUT_OF_BOUNDS, // this is automatically set to 3
};

EncoderState encoderState = ENC_ST_SCREEN; // global variable h…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by VasilKalchev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
type: question Need help using the repository.
3 participants
Converted from issue

This discussion was converted from issue #37 on November 04, 2021 19:31.