have a recurring event every x seconds

what would be the best way to include a recurring event like the one shown above inside my code ?

In the same way as the 'blink without delay' example works. Implement a finite state machine. Google is your friend.