Closed andrewbpowers closed 2 years ago
...
?
prev=0,0 new=0,1
Hi,
It is saying that the previous reading from the encoder was 0 and 0 and the current is 0 and 1 which never happens on mine but it could just be that yours is slightly different? if it is working I wouldn't worry about it just comment out the line
If you wished you could modify the line: else if (serialDebug) Serial.println("Error: invalid rotary encoder pin state - prev=" + String(encoderPrevA) + "," + String(encoderPrevB) + " new=" + String(pinA) + "," + String(pinB));" to: Serial.println(" Encoder pin state - prev=" + String(encoderPrevA) + "," + String(encoderPrevB) + " new=" + String(pinA) + "," + String(pinB)); temporarily just to see how your encoder is behaving and modify the code to suit.
Hello Alan!
Thank you very much for your feedback and the helpful informations.
I really like your menu! :-)
One more question… sorry! ;-)
How can I change the “staticMenu” to “dynamic” or better said, to a mixture of both. So, for example, a time is displayed with seconds or a measured value AND you can switch to another menu via a menu item or change the display or switch off completely!?
Stay healthy and take care!
Hi,
If you have a look at my BasicWebserver sketch I have an oled option which uses this menu and shows how to switch between different menus (main_menu and Menu2 in this case). https://github.com/alanesq/BasicWebserver I think I have developed this menu a bit more there and have not got round to updating this one yet
You could add the time etc. just by writing direct to the display on top of the menu with commands such as: display.setCursor(0, 0); display.print("hello"); display.display();
Very big thank you! 👍 I will have a look at it and try your solutions.
The main problem I had so far was that e.g. in the "Display off" example something is displayed, but the loop does not continue to run and thus no real-time information could be displayed or a menu. I have e.g. set a value to "1" by selecting a menu item. In the loop then runs a "blink without delay", until the previous menu item was selected again. This works quite well. However, I do not know how I can then display in a "menu", how often, for example, the LED has blinked. I hope that was somehow understandable! ;-)
You may like to have a look at the new version I have just uploaded as I have completely re-written it so that it is none blocking.
i.e. the menus can be used without it stopping other tasks from continuing
Hello Alan!
Thank you for the hint. That sounds great. I will definitely have a look at it. Thanks a lot!
Take care
I think this error is just caused by bouncing in the switch and so I have removed the error message from the sketch
Understand! Thank you very much, for your efforts! :-)
Hello!
First of all, thank you for your example!
I get the following errors in the serial monitor:
Error: invalid rotary encoder pin state - prev=0,0 new=0,1
However, navigating through the menu works. Any idea why this happens? I use the KY040 Rotary Encoder (https://www.ebay.co.uk/itm/274296632950). Thanks in advance for any tip and help! :-)
Take care...