Ball Gripping System

Hello , I have the project to program a servo motor that will allow me to catch or let go a ball

would know you please help me?

Is this a programming question ?

By 'catch', do you mean catch a ball that is flying through the air?

First you need to read and understand the simple servo examples here; have you tried them? (They don't answer your question but you do need to know this first anyway.)