Help me to combine these codes and the servo motor to return to its original position

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

What should the combined sketch do ?

Please post your best attempt at combining the sketches and explain any problems