Working with servos and want to be able to press or hold a button, to save whatever angle the servo is at, then press another button and have the servo return to position saved even if reset.
New to the programming part of builds so please explain how everything works and why it works if you can.
Thanks!
Copy and paste the code into the forum using code tags (the button that looks like </> ).
Explain what you want to accomplish.
Explain what your code actually accomplishes versus what you want to accomplish.
You provide details of what hardware you have and how it is wired.
You provide information about what Arduino you have, and any shields.
A servo does not tell you what angle it is at. Either you know what angle you commanded, or you have some sort of sensor that tells you what angle the servo is at. Let us assume that you know what angle you commanded. Then, your code needs to save the commanded angle when the switch goes from unpressed to pressed.
When the second button is pressed, you need to command the servo to the saved angle.
You have not explained what you want to have happen if the second button is pressed before the first button is pressed, or what happens if no buttons are pressed or if both buttons are pressed.