I'm building an Arduino Mega based tennis ball machine, and I want to control the ball rate frequency using a programming logic like this:
every 3 seconds
-- if the ball is ready and if the motors are running then
---- shoot the ball
the Arduino program is already doing other things, like listening for incoming serial data from the tbm remote control, setting pins high or low, sending serial data out, etc.: what would be the best way to include a recurring event like the one shown above inside my code ?
awesome, thanks to you too. I was worried I needed to have to deal with interrups and maybe rearrange my actual code, which has grown quite long now and cumbersome to mess with.