giving a 360 continuous servo positional awareness with a switch system

do you know how to write the code to achieve this?