A general method to stabilize unstable periodic orbits for switched dynamical systems with a periodically moving threshold. (14th October 2018)