Rotary encoder 4 choices

If you only need 4 directions I would go with a rotary and an LCD menu, scrolling back and forth through North, E, S and W, selecting the desired direction with a press on the rotary button. This will then trigger the required action (where you switch OFF the previous LED and switch ON the selected direction LED - this requires that you "note" in the same function, which LED is currently ON, or - simplest way - switch OFF all other LEDs, despite of that 2 of them definitely are already OFF).

I recently posted in the German speaking forum a simple menu, based on a rotary encoder and its button to scroll through a "flat = 1 layer" menu. I think that is pretty simple and a good starting point for you.

The comments in the sketch are in English, so the English speaking people won't be lost.
I am sure that some more experienced guys here could improve the sketch, but for me - it's doing what I wanted to achieve.

So have a look at it and replace the "cocktails" by your own application.

Here is the link to the project (my code is in post #6).

In that post I have attached Ben Buxton's rotary encoder library, which, after extensive testing of numerous other libraries or direct codings, turned out to be by far the best one. My rotary encoder is a very cheap and simple one, with that library you don't need interrupt pins (in the sketch I used them - but they are not actually needed, if you have to use them for other activities in your code).

The original library of Ben is available on github plus there you can find a modified one. But both don't come with the button supported as in "my" library. In fact it is a library which I found last year somewhere in the I-net and it is actually the same algorithm as Ben is using in the library on his blog, but - I have no idea where I found the attached one with the implemented button support incl. debouncing.

So best luck and good start. Let us know when you are a step further.

Rotary_Button.zip (9.31 KB)