Arduino codings

Ok
My standard recipe:
As a basis, study the IPO model and then take a bag of data structures, timers and a small finite state machine and stir everything together to the desired functionality. And don't forget the seasoning.