initial version of distance sensor code