How can i program a motor to do something like this video?

so in this video there is a motor that is letting one marble out at a time. how could i code something like this.VEX Materials Sorter #4 - YouTube

its around 0:50 seconds in the video. thanks!:smiley:

Thanks so much! Im using robotc btw Which is what you wrote it in i think. im not sure im new to this but thanks for the help!

will this automatically start, and then stop and then start again?

Can you explain it more in depth I’m not understanding this can you remove the releasemarble, marblesleft, etc