Hi
I have a piece of code running in my sketch that is not performing as it should be. It’s probably not a very efficient code either since I’m still learning.
The code works but there’s something going wrong with the timing. I have isolated the code into a new sketch as I though it might be something to do with the rest of the code. But the problem stays the same.
What it does is:
→ long hold to enter INIT mode [3]
→ enter initializing mode and move stepper1 to the far right until an endstop is found en set it to 0.
→ manually move stepper2 to a position and set # steps to 0.
→ double click to confirm
→ move stepper1 to the far left until an endstop is found and record that # of steps taken.
→ manually move stepper2 to a position and record that # of steps taken.
→ double click to confirm
→ confirmation message and set mode to idle
The problem I keep having and can’t get solved is that after entering the INT mode, the ‘double click’ is not tap-tap, but more of a tab-taaaaab. Sometimes it won’t respond right away and I have to so that 4 times… I have no delays that can interfere with this and maybe I should have done it in a another manner. I use ‘state machine’ code for another part in the sketch but I’m not sure I van use a ‘confirm’ button between the states…
I have stripped the code from the original sketch since it’s 5 tabs and a lot of comments by me, but completely the same otherwise. I checked this code of course and the problem is the same.
Code was too long to include, is an attachment now.
Thanks!
EDIT: Oh I forgot to mention that I also use long press and double-click in the same sketch for a rotary button and that works fine
test_sketch.ino (8.23 KB)